Aggregating index overview
DELETE
or UPDATE
operations, are made to the base table. Firebolt also enhances performance by dividing aggregating indexes into smaller segments that are distributed across multiple engine nodes. This allows queries to run in parallel across these nodes, improving both scalability and efficiency while ensuring that the data remains consistent and accurate.
Topics:
COUNT(*)
aggregations
A COUNT(*)
aggregation is automatically added to every aggregating index unless explicitly specified by the user. This ensures the index can accurately handle DELETE
operations by tracking the number of rows affected. The aggregating index adjusts its precomputed results to remain synchronized with the base table, maintaining consistency and ensuring accurate query results.
Parameter | Description |
---|---|
<index_name> | The name of the aggregating index. |
<table_name> | The name of the table on which the index is created. |
<grouping_element> | Expressions specified as grouping keys or dimensions when creating the index. |
<aggregation_element> | Aggregation functions applied to specific expressions. |
sales_agg_index
on the sales
table and precomputes the SUM
and COUNT
aggregations:
product_id
and region
are grouping keys that are grouped together as grouping_element
. These keys define how the data is grouped for aggregation, similar to the GROUP BY
clause in a SQL query. Subsequent queries using these aggregations can retrieve the precomputed values directly from the index, avoiding a full table scan.
Because the code example precomputes SUM
and COUNT
, subsequent queries using these aggregations can retrieve the precomputed values directly from the index, avoiding a full table scan.
INSERT
, DELETE
, and UPDATE
on the base table.
Vacuuming
To ensure optimal query performance, you should periodically vacuum the aggregating index. VACUUM helps to:
DELETE
operations on the base table.DELETE
or UPDATE
on the base table can also cause fragmentation, impacting query performance.