-2

我在 sql server 中有大约 30-45 百万行的数据。

使用 order by 子句对这些数据进行排序大约需要一个小时或更长时间。有没有办法在不使用 order by 子句的情况下进行排序。

4

2 回答 2

1

我认为您应该对用于排序的字段使用索引。这可以提高速度。

于 2013-09-17T10:54:58.213 回答
1

First of all, check your indexes. If the database takes so long to do such a simple operation, it's obviously wrong or the server is too old. This amount of information is acceptable (50,000,000 rows is not too much).

You can sort the data in external program, but it won't be as efficient as doing from the DB (after all, this was designed to do this kind of things).

http://www.sqlteam.com/article/sql-server-indexes-the-basics

于 2013-09-17T10:57:02.047 回答