Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Improving query performance by using views

I have a large table with 10+ millions records in a SQL Server database. The table contains certain type of data for all 50 states in the US. So if I create 50 views, one for each state, from this table, would the performance of making queries from my application be improved? Other suggestions?

like image 960
Kevin Le - Khnle Avatar asked Aug 04 '26 06:08

Kevin Le - Khnle


1 Answers

No. A view is a macro that expands so the same tables end up in the plan anyway.

Unless it's indexed. 50 indexed views is most likely overkill.

If you have slow performance with 50 million rows (it's not that much really) then it's an indexing problem.

Edit:

To start with, I'd use the weighted missing index dmv query to see where you get the most bang for your buck

like image 129
gbn Avatar answered Aug 06 '26 16:08

gbn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!