Statistics#

Statistics describe the distribution of values in columns and help the query planner choose efficient plans. Querona gathers them for a whole object at a time: a row count for the object and, for the columns configured for it, a distinct-value count and an average length.

UPDATE STATISTICS#

Refreshes the statistics of a table or view. This runs the same gathering as the qua_update_object_statistics procedure and the scheduled statistics jobs, needs the same ALTER permission on the object, and moves the object’s last statistics calculation, which qua_table_usage, STATS_DATE and sys.dm_db_stats_properties report.

UPDATE STATISTICS table options

Only the bare form and WITH FULLSCAN are accepted, and they behave identically: Querona reads the whole object when it gathers statistics, so a full scan is what it already does. Every other option is refused, because statistics are gathered for an object as one unit and a narrower request has nothing to act on:

  • SAMPLE and RESAMPLE

  • NORECOMPUTE

  • INCREMENTAL and PERSIST_SAMPLE_PERCENT

  • a named statistics object, an index or a column list as the target

CREATE STATISTICS#

Not supported. Querona decides for itself which columns carry statistics, so there is nothing for an explicit statistics object to add. Refreshing what it gathers is done with UPDATE STATISTICS above.

Examples#

UPDATE STATISTICS dbo.Product;

UPDATE STATISTICS dbo.Product WITH FULLSCAN;