通过使用视图提高查询性能 [英] Improving query performance by using views

查看:184
本文介绍了通过使用视图提高查询性能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个大表,在SQL Server数据库中有超过10000万条记录。该表包含美国所有50个州的某种类型的数据。因此,如果我创建50个视图,每个状态一个,从这个表,将从我的应用程序进行查询的性能会提高吗?其他建议?

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?

推荐答案

否。视图是一个扩展的宏,因此相同的表格最终会出现在计划中。

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

除非已建立索引。

如果你有5000万行的缓慢性能(这不是真的),那么它是一个索引问题。

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

编辑:

首先,使用加权缺失索引dmv查询查看其中你得到最大的惊喜。

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

这篇关于通过使用视图提高查询性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆