sql - Does using fully qualified names affect performace? -
sql - Does using fully qualified names affect performace? -
does utilize of qualified table names in sql server have impact on performance?
i have query joining 2 tables in different databases dba has suggested omit database name on host query guessing either performance or convention.
all tables qualified
use [dbfoo] select * [dbfoo].[dbo].[people] inner bring together [dbbar].[dbo].[passwords] b on b.[entityid] = a.[entityid] preferred?
use [dbfoo] select * [dbo].[people] inner bring together [dbbar].[dbo].[passwords] b on b.[entityid] = a.[entityid] does create difference?
fully qualified names preferred, considerations apply. depends lot on requirements , single reply may not suffice scenarios.
note compilation binding, not execution one. if execute same query one thousand times, first execution 'hit' time, means lookup time less in case of qualified names. means using qualified names save compilation overhead (the first time when query executed).
the rest reuse compiled one, names resolved object references.
this msdn article gives fair guidance on sql server best practices. (check section named: how refer objects)
this link explains in more details on set of steps done resolve , validate object references before execution: http://blogs.msdn.com/b/mssqlisv/archive/2007/03/23/upgrading-to-sql-server-2005-and-default-schema-setting.aspx
going through sec link, conclusion says that:
obviously best practice still stands: should qualify object names , not worry name resolution cost @ all. reality is, there still many imperfect applications out there , setting help great cases.
also, in case database name alter not allowed on production environment, may think include database names in qualified names.
sql sql-server tsql
Comments
Post a Comment