I have a database in SQL Server 2008, with the final data table having about 2 million rows. The development team is implementing a new application and they have suggested changing the column name to reflect what the business likes it to be. They already have their application built in the test environment with the new column names. Will there be a performance penalty if I have them connect to my database via a view with column name aliased to match the column names used by the application? I need to provide a justification for not to change the column names in the application. Any help will be appreciated. Thanks.
SQL Server – Performance Hit with Column Alias
aliassql serverview
Related Question
- SQL Server – Creating a Computed Column That Requires Input to Select
- Postgresql – Turn off auto qualification of table names when creating a view
- Sql-server – Implicit conversion warning despite persisted computed column vs. performance hit from UDF in persisted computed column definition
- PostgreSQL Column Alias in FROM Clause
- SQL Server – Create View with Column Aliases or Change Column Names
- Sql-server – Dynamic SQL Query with Paging, Performance and Optimization
- SQL Server – Proper Way to Add New Column in Database
- T-SQL Update – How to Update Random String Value in Column
Best Answer
A view, being just a query persisted in the database, should not theoretically have any performance hit. Same is true for column or table aliases. The performance hit, if any, will be barely noticeable once the execution plan is compiled and cached by the database engine. So, there is no performance justification not to use column aliases based on views. Having said that, I second Aaron Bertrand that the application should not have been written in incorrect schema. I would fix the application just for the sake of best practices and not to "create a permanent messy layer of indirection" as Aaron Bertrand said.