开发者

Database sorting SQL Server

I made a windows app and I need to add a "sort" by selected column. The grid has 4 columns and lot of records (paged of course).

The question is:

Sho开发者_StackOverflowuld I consider to add an index for every column that need sorting in the grid?

thanks in advances.

Regards


Yes - consider adding the indexes.

The only way to be sure that things you do for performance reasons really help is to test them. But if there's lots of data in the table and people are likely to use the sorting on all those columns, then I'd add the indexes.


Choices of index depend on a lot of factors, including frequency of insert/update/delete queries vs. frequency of select queries. Indexes can help with ORDER BY, and four indexes may not be too bad for performance otherwise, but it really depends what you are trying to accomplish.


MSSQL has clustered indexes which improves order BY http://www.databasejournal.com/features/mssql/article.php/1443581/Index-Optimization-Tips.htm

You can have only one clustered index per table :-(

Your indexes must fit in RAM.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜