This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
admin:indexing:basicstrategies:orderby [2011/01/13 22:46] els |
— (current) | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | {{page>:top_add&nofooter&noeditbtn}} | ||
| - | ====== Administration: Indexing Strategies ====== | ||
| - | |||
| - | ===== Basic Strategies ===== | ||
| - | |||
| - | [[admin:indexing:basicstrategies:home|Overview]] | | ||
| - | [[admin:indexing:basicstrategies:criteria|Criteria]] | | ||
| - | [[admin:indexing:basicstrategies:joins|Table Joins]] | | ||
| - | [[admin:indexing:basicstrategies:aggregations|Aggregations]] | | ||
| - | **[[admin:indexing:basicstrategies:orderby|Ordering]]** | | ||
| - | [[admin:indexing:basicstrategies:validate|Validating Strategy]] | ||
| - | |||
| - | ---- | ||
| - | |||
| - | ==== Optimizing Ordering ==== | ||
| - | |||
| - | Ordering is usually optimized by creating an index containing all of the columns in the ORDER BY clause. The order of the column in the index must match the order of the columns in the ORDER BY clause. At present, only ascending ORDER BY clauses are optimized. | ||
| - | |||
| - | |||
| - | == Example 1. Single-column ORDER BY clauses == | ||
| - | |||
| - | In this example, the ORDER BY clause is optimized using the same index used for processing criteria. | ||
| - | |||
| - | select NAME, ADDRESS1, ADDRESS2, PHONE | ||
| - | from INDIVIDUALS | ||
| - | where STATE in ('CA','CO') and NAME = 'John' | ||
| - | order by STATE | ||
| - | |||
| - | The STATE index will be used to satisfy both the criteria and the ORDER BY clause. | ||
| - | |||
| - | |||
| - | == Example 2. Multi-column ORDER BY clauses == | ||
| - | |||
| - | In this example, the ORDER BY clause will be optimized with a multi-column index. | ||
| - | |||
| - | select NAME, ADDRESS1, ADDRESS2, PHONE | ||
| - | from INDIVIDUALS | ||
| - | where STATE in ('CA','CO') and NAME = 'John' | ||
| - | order by STATE, CITY | ||
| - | |||
| - | A multi-column Omnidex index containing STATE and CITY, in that order, will optimize this ORDER BY clause. | ||
| - | |||
| - | |||
| - | |||
| - | ===== ===== | ||
| - | |||
| - | **[[prev|Prev]]** | **[[next|Next]]** | ||
| - | |||
| - | ====== Additional Resources ====== | ||
| - | |||
| - | See also: | ||
| - | |||
| - | {{page>:admin:indexing:see_also&nofooter&noeditbtn}} | ||
| - | |||
| - | {{page>:bottom_add&nofooter&noeditbtn}} | ||