0

I am working on project with huge data and usage. Many procedures are being used with multiple joined SQL Select queries.

My friend told me that using column names with table name is much better in respect to performance instead using column with table alias.

Query my friend suggested

select Employee.Name, Employee.Address, District.DistName
From Employee
INNER JOIN District ON Employee.DistCode=District.DistCode

Query I am currently using

select e.Name, e.Address, dist.DistName
From Employee e
INNER JOIN District dist ON e.DistCode=dist.DistCode

As far as I know, table aliases boost up query readability. Is there also any performance effect with table aliasing vs direct table name.

Dale K
  • 25,246
  • 15
  • 42
  • 71
user1482852
  • 94
  • 4
  • 11
  • 1
    No. Everything is resolved at compile time. – pmbAustin Nov 07 '19 at 18:18
  • so, is there any extra overhead occur on compiler to resolve actual table from alias? – user1482852 Nov 07 '19 at 18:23
  • Ask your "friend" for proof with an actual demonstration. – SMor Nov 07 '19 at 19:47
  • 1
    No, there's no actual over-head. If you do want a (very) slight improvement, you should fully schema qualify your table names (like "FROM dbo.Employee e") – pmbAustin Nov 07 '19 at 19:48
  • Possible duplicate of [How does table alias names affect performance?](https://stackoverflow.com/questions/8363108/how-does-table-alias-names-affect-performance) – JNevill Nov 07 '19 at 19:49
  • Interesting comment in that potential duplicate above - at the lower-voted answer there is a comment suggesting a link made in the question's comments has an answer that suggests a rare issue in SQL Server 2000. Perhaps where this thought originated? (My sister's friend's mother's best friend's said once...) – JNevill Nov 07 '19 at 19:55
  • Wow I have heard some strange wives tales about performance in sql server but this is a new one. – Sean Lange Nov 07 '19 at 20:01

0 Answers0