This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
admin:indexing:strategies:aggregations [2012/01/30 18:03] doc |
admin:indexing:strategies:aggregations [2016/06/28 22:38] (current) |
||
---|---|---|---|
Line 21: | Line 21: | ||
The advantage of this optimization approach is that a small number of indexes can support nearly any combination of GROUP BY columns, providing high performance at little cost. | The advantage of this optimization approach is that a small number of indexes can support nearly any combination of GROUP BY columns, providing high performance at little cost. | ||
- | There are some situations in which specialized index is better for optimizing a query. When the GROUP BY column have especially high cardinality, such as over 64,000 distinct values, it will be necessary to create a multi-column index as described below. Additionally, if the same GROUP BY columns are used repeatedly, a multi-column index will perform faster. | + | There are some situations in which specialized indexes are better for optimizing a query. When a GROUP BY column has especially high cardinality, such as over 64,000 distinct values, it is necessary to create a multi-column index as described below. Additionally, if the same GROUP BY columns are used frequently, a multi-column index will provide even faster performance. |
==== Optimizing Other Aggregations ==== | ==== Optimizing Other Aggregations ==== | ||
Line 37: | Line 37: | ||
In this example, the COUNT(*) does not require any additional indexes. | In this example, the COUNT(*) does not require any additional indexes. | ||
- | <code sql> | + | <code> |
select count(*) | select count(*) | ||
Line 51: | Line 51: | ||
In this example, the COUNT(*) does not require any additional indexes, but the GROUP BY clause requires an index. | In this example, the COUNT(*) does not require any additional indexes, but the GROUP BY clause requires an index. | ||
- | <code sql> | + | <code> |
select GENDER, count(*) | select GENDER, count(*) | ||
Line 66: | Line 66: | ||
In this example, the GROUP BY clause contains columns from multiple parents. | In this example, the GROUP BY clause contains columns from multiple parents. | ||
- | <code sql> | + | <code> |
select C.DESCRIPTION, S.DESCRIPTION, H.CITY, count(DISTINCT H.ZIP) | select C.DESCRIPTION, S.DESCRIPTION, H.CITY, count(DISTINCT H.ZIP) | ||
Line 83: | Line 83: | ||
In this example, both SQL statements can be satisfied by one Omnidex index. | In this example, both SQL statements can be satisfied by one Omnidex index. | ||
- | <code sql> | + | <code> |
select GENDER, BIRTHDATE, count(DISTINCT HOUSEHOLD) | select GENDER, BIRTHDATE, count(DISTINCT HOUSEHOLD) | ||
Line 91: | Line 91: | ||
- | <code sql> | + | <code> |
select HOUSEHOLD, GENDER, count(*) | select HOUSEHOLD, GENDER, count(*) | ||
Line 105: | Line 105: | ||
This sample environment file shows the Omnidex indexes that will optimize these queries. | This sample environment file shows the Omnidex indexes that will optimize these queries. | ||
- | <code sql> | + | <code> |
create environment | create environment | ||
in "simple.xml" | in "simple.xml" |