Logical profiles
The logical profile of a sub-plan consists of an estimate for the number of produced rows, and optional column-level estimates (such as number of distinct values). In addition to that, the profile has a source that reflects how this information was computed.- The default statistics source serves hard-coded values for the number of rows in a table. These values depend only on the table type, and not on the actual data contained in the table.
- The storage manager statistics source serves row counts based on metadata maintained by the storage manager. These statistics are always up-to-date.
- The estimated source is assigned to profiles that were computed using Firebolt’s estimation model. These profiles are computed by the optimizer based on the logical profiles of the sub-plan inputs.
EXPLAIN command with the statistics option.
The following code snippet shows the logical profiles of a simple query:
- The profile of the
StoredTablenode hasmetadatasource, reflecting the fact that the row count estimate was obtained the metadata served by the storage manager. The value (2880400) accurately reflects the current number of records in thestore_salestable. - All other profiles have
estimatedsource. - The profile of the
Filternode reflects the fact that after applying thess_item_sk = 42filter, the number distinctss_item_skwill be 1. - The profile of the
Sortnode (which also applies thelimit 10clause) reflects the fact that the number of output rows will be 10. - The profiles of the two
Projectionnodes inherit the profiles of their inputs.
Controlling statistics sources
Firebolt gives you the ability to turn storage manager statistics on and off using theenable_storage_statistics session parameter.
Here is an example that uses the same query as above in a session context where enable_storage_statistics is set to false.
Observe that the logical profile of the StoredTable node now has source hardcoded, and the estimated number of rows is 100 million.
enable_storage_statistics = false