我的SQL Server表中有大约820,000条记录,从表中选择数据需要5秒钟。该表在时间列上有一个聚集索引,该时间列可能为NULL (到目前为止,它不包含任何NULL值)。为什么只获取这么多记录需要5到6秒?
发布于 2019-05-29 11:22:14
我建议你这样做:
1.Check if you are using Clustered and Non-Clustered in you columns (best way I think with a sp_help NameTable).
2.When you using comand "select" specific always all name columns (never use Select * From ..... ).
3.If you are using SSMS check in tools SQL Execution Plan , with this tool you can make simple review your TSQL (you can see cost
each query you make.
4.Dont use "convert(...." in clause WHERE , for example .. Where Convert(int,NameColum)=100.https://stackoverflow.com/questions/56306862
复制相似问题