Chapter 3. ORDER BY

   

The ORDER BY clause causes sorts. Sorts take time. In this chapter, we'll look at how much time, and what you can do about it.

Some of this chapter is also relevant to other situations that cause sorts. It is a simple matter to see that DBMSs may choose to sort a list when they need to discover duplicates, so GROUP BY, DISTINCT, CREATE [UNIQUE] INDEX, and UNION might use the same algorithms that are used by ORDER BY. Less commonly, DBMSs may choose to sort any two lists and merge them when they need to perform either inner or outer joins. In all those cases, though, the sorting is a side effect, so we'll focus on ORDER BYwith the admonishment that what we're saying may be applicable more broadly.

   


SQL Performance Tuning
SQL Performance Tuning
ISBN: 0201791692
EAN: 2147483647
Year: 2005
Pages: 125

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net