docs/src/main/sphinx/optimizer/statistics.md
Trino supports statistics based optimizations for queries. For a query to take advantage of these optimizations, Trino must have statistical information for the tables in that query.
Table statistics are estimates about the stored data. They are provided to the query planner by connectors and enable performance improvements for query processing.
The following statistics are available in Trino:
For a table:
For each column in a table:
The set of statistics available for a particular query depends on the connector being used and can also vary by table. For example, the Hive connector does not currently provide statistics on data size.
Table statistics can be displayed via the Trino SQL interface using the command.
Depending on the connector support, table statistics are updated by Trino when
executing data management statements like INSERT,
UPDATE, or DELETE. For example, the Delta Lake
connector, the Hive connector, and
the Iceberg connector all support table statistics
management from Trino.
You can also initialize statistics collection with the command. This is needed when other systems manipulate the data without Trino, and therefore statistics tracked by Trino are out of date. Other connectors rely on the underlying data source to manage table statistics or do not support table statistics use at all.