This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
admin:indexing:concepts:aggregations [2012/04/04 15:24] doc removed |
admin:indexing:concepts:aggregations [2016/06/28 22:38] (current) |
||
---|---|---|---|
Line 26: | Line 26: | ||
The following query requests a simple count from a table. | The following query requests a simple count from a table. | ||
- | <code sql> | + | <code> |
select count(*) | select count(*) | ||
Line 42: | Line 42: | ||
Queries that aggregate data often use GROUP BY clauses or other aggregation functions. These queries can be optimized with Omnidex indexing as well. The following query shows counts from the HOUSEHOLDS table aggregated by STATE, CITY and ZIP. | Queries that aggregate data often use GROUP BY clauses or other aggregation functions. These queries can be optimized with Omnidex indexing as well. The following query shows counts from the HOUSEHOLDS table aggregated by STATE, CITY and ZIP. | ||
- | <code sql> | + | <code> |
select STATE, CITY, ZIP, count(*) | select STATE, CITY, ZIP, count(*) | ||
Line 55: | Line 55: | ||
These techniques can be used even after other indexes have been used to process criteria. After the criteria has been processed, the isolated record pointers can be used as a filter when the aggregation index is scanned. This allows for great flexibility, since the columns referenced in criteria do not need to be included in the aggregation index. In the following query, the same aggregations are restricted to people in the United States. | These techniques can be used even after other indexes have been used to process criteria. After the criteria has been processed, the isolated record pointers can be used as a filter when the aggregation index is scanned. This allows for great flexibility, since the columns referenced in criteria do not need to be included in the aggregation index. In the following query, the same aggregations are restricted to people in the United States. | ||
- | <code sql> | + | <code> |
select STATE, CITY, ZIP, count(*) | select STATE, CITY, ZIP, count(*) |