I have a C # project that launches several requests at startup. I tried to find out if I can optimize the runtime. Other requests take less than 100 ms, but this request is a bit slower.
SELECT * FROM
fn_listextendedproperty(default, default, default, default, default, default, default)
where name = 'CUSTOM_EX_PROP'
301 ms
This is normal? Can this query be optimized? Is there a faster way to read an extended database property?
Here is my C # code in case
var watch = System.Diagnostics.Stopwatch.StartNew ();
using (SqlDataAdapter sda = new SqlDataAdapter (new SqlCommand (query, _con))) {
sda.Fill (dt);
}
watch.Stop ();
var elapsedMs = watch.ElapsedMilliseconds;
System.Diagnostics.Debug.Print (query + "\r\n" + elapsedMs.ToString () + " ms");
EDIT. As @Liam pointed out that it smells like an XY problem, let me tell you about a real scenario. The database version is stored in an extended property, and when I connect to the database, I just want to make sure the version is right. That is why I read its extended property at startup.