SQL Server Performance

Using Table Alias Name

Discussion in 'General DBA Questions' started by SQL2000DBA, Jun 28, 2006.

  1. SQL2000DBA New Member

    Hi,

    Is there is any overheads using Table Alias name. If yes then please let me know what all advantage and disadvantage of using Alias name.

    Thanks and Regards
    Ravi K
  2. Madhivanan Moderator

    No disadvantage at all. If you use Joins where two or more tables have same column name you must use Table Alias

    Madhivanan

    Failing to plan is Planning to fail
  3. ramkumar.mu New Member

    Even in joins, we can avoid alias names and can directly use table names instead. i think the advantage comes when we have bigger table names.

    Thanks,
    Ram

    "It is easy to write code for a spec and walk in water, provided, both are freezed..."
  4. Madhivanan Moderator

    >>Even in joins, we can avoid alias names and can directly use table names instead.

    Now Table names act as Alias Names

    Madhivanan

    Failing to plan is Planning to fail
  5. SQL2000DBA New Member

    Hi,

    Thanks for your response.

    Currently I am designing database and opting for a solution to use first four character of table name as prefix for each column name. This will avoid alias name and make coding easier and readable format.

    Thanks and Regards
    Ravi K
  6. FrankKalis Moderator

    There's always a great debate when it comes to naming conventions. Actually I think, any naming convention you have is better as having none at all. So, when you can live with your convention and enforce it consequently, go with it. But there isn't any significant overhead when using tables aliases anyway.

    --
    Frank Kalis
    Microsoft SQL Server MVP
    http://www.insidesql.de
    Heute schon gebloggt?http://www.insidesql.de/blogs
  7. Adriaan New Member

    Apart from the readability aspect - in order to improve the chances of SQL Server being able to reuse a cached execution plan for your query or sproc, you must add the owner prefix to all objects. In a query, you should also specify the table before each mention of a column.

    When you include the owner reference, you must repeat it everywhere in the query - that's when you realize that using an alias will save you a lot of typing.

Share This Page