There is no difference in SQL Server between writing a SELECT statement and putting that SELECT statement in a view. A view is basically a string macro for a select statement, in SQL Server. Other engines treat views differently.
Query Performance when selecting from a view vs a table
Hi All, I have been searching the forums for previous posts on this issue but none of them seem to apply to my scenario. I thought I would post here in hopes that someone can help. I work in an organization with a lot of legacy databases where data is not stored in the correct format for their data types. E.G., dates are stored as numbers in yyymmdd format, some numbers are stored as text with embedded commas and bit values are stored as text 'True' and 'False'. In addition, some of the data is segmented across different databases and across multiple tables. When writing reports, I write a lot of data conversions and UNION queries to pull the data into a single datasets etc and up until now, I have been able to write this into the SQL Query designer of MS Report Builder/Visual Studio. I am about to start working with Power BI Desktop and it seems that this functionality has to be performed in a view. If I have a table with 250,000 + rows and I write a select query with numerous string and number conversions from multiple tables. If I only need a small subset of the data .e.g. a specific customer ID. Will the view have to build the entire dataset and perform the conversions and functions on every row of data before it would then return the smaller subset of the customers data? My concern is the performance of the view would be significantly slower to run when selecting from a view than it would to directly query the tables. How would this work? Would the performance be the same as querying the table directly or do I have a valid concern? Thanks