Can I optimise a SQL select on fn_listextendedproperty?

Viewed 310

I've a c# project that runs few queries at startup. I was trying to find out if I can optimize the execution time. The other queries take less than 100 ms but this query is a bit slower.

SELECT * FROM 
  fn_listextendedproperty(default, default, default, default, default, default, default) 
  where name = 'CUSTOM_EX_PROP'

301 ms

Is it normal? Can this query be optimized? Is there a faster way to read the database extended 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 that it smells XY Problem, let me tell the actual scenario as well. The version of database is stored in its extended property and when I connect to database I just want to make sure the version is right. That is why I am reading its extended property at startup.

2 Answers
Related