Sorting is not necessarily a liability. The sort algorithm is highly tuned and extremely efficient. It is as fast as any external sort program that you might apply to the same data. You need not avoid infrequent sorts or sorts of relatively small numbers of output rows.
Try to avoid or reduce the scope of repeated sorts of large tables. The optimizer avoids a sort step whenever it can use an index to produce the output in its proper order automatically. The following factors prevent the optimizer from using an index:
For another way to avoid sorts, see Using Temporary Tables to Reduce Sorting Scope.
If a sort is necessary, look for ways to simplify it. As discussed in Sort-Time Costs,, the sort is quicker if you can sort on fewer or narrower columns.
Enterprise Edition Home | Express Edition Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]