Acceleration SQL Statements
Reflections can be defined on an existing dataset using SQL commands.
Raw Reflections
Creating Raw Reflections
ALTER DATASET <DATASET_PATH>
CREATE RAW REFLECTION <REFLECTION_NAME>
USING
DISPLAY (
field1,
field2,
field3
)
[PARTITION BY (field1)]
[LOCALSORT BY (field2)]
[DISTRIBUTE BY (field2)]
Aggregate Reflections
Creating Aggregate Reflections
ALTER DATASET <DATASET_PATH>
CREATE AGGREGATE REFLECTION <REFLECTION_NAME>
USING
DIMENSIONS (
dimension1,
dimension2
)
MEASURES (
measure1,
measure2
)
[PARTITION BY (dimension1)]
[LOCALSORT BY (dimension2)]
[DISTRIBUTE BY (dimension2)]
When handling timestamps as dimensions, Dremio defaults to using the full granilarity of the provided field. In certain cases, users may opt to have less granularity. This can be configured to be at DAY level by declaring dimensions as follows dimension1 by day
. This is also the UI default.
External Reflections
Creating External Reflections
ALTER DATASET <SOURCE_DATASET_PATH>
CREATE EXTERNAL REFLECTION <REFLECTION_NAME>
USING <TARGET_DATASET_PATH>
In the example above, Dremio can leverage target_dataset
in place of the dataset (source_dataset
) that was altered.
Dropping Reflections
All reflection types can be dropped using:
ALTER DATASET <DATASET_PATH> DROP REFLECTION <REFLECTION_NAME>