All Products
Search
Document Center

Hologres:HG_STATS_MISSING

Last Updated:Mar 26, 2026

HOLOGRES_STATISTIC.HG_STATS_MISSING lists tables in the current database that are missing statistics. Query this view to identify which tables need ANALYZE, then run ANALYZE selectively to improve query performance.

Tables without up-to-date statistics cause the query optimizer to generate poor execution plans, such as an incorrect join order that results in large-table shuffles, slow queries, or out-of-memory (OOM) errors.

Prerequisites

Before you begin, ensure that you have:

  • A Hologres instance running V2.2.15 or later

  • SCHEMA USAGE or higher permission on the schemas you want to inspect

Fields

The following table describes the fields in HOLOGRES_STATISTIC.HG_STATS_MISSING.

FieldData typeDescription
schemanameTEXTSchema name
tablenameTEXTTable name
nattrsINTEGERNumber of columns
tablekindTEXTTable type (for example, internal table, foreign table)
fdwnameTEXTForeign data wrapper (FDW) name. Populated for foreign tables only
autovacuum_enabledTEXTWhether Auto Analyze is enabled for the table. Available in V3.1 and later
reasonTEXTReason why statistics are missing. Use this field to determine the next action. Available in V3.1 and later
Note

The view includes non-partitioned tables, partitioned tables, foreign tables, and materialized views. Other table types are excluded and are not counted in the Number of tables missing DB statistics monitoring metric.

Find and fix tables with missing statistics

Step 1: Check the monitoring metric

To see which databases have tables missing statistics, open the Hologres Management Console. In the left navigation pane, click Instances. On the product page of your target instance, in the left navigation pane, click Monitoring Information to view the Number of tables missing DB statistics metric.

Monitoring console showing the Number of tables missing DB statistics metric

Step 2: Query the view

Run the following query in the target database to list all tables with missing statistics.

SELECT * FROM hologres_statistic.hg_stats_missing;

Example output:

schemaname |     tablename     | nattrs |     tablekind     | fdwname
------------+-------------------+--------+-------------------+---------
 public     | spatialxxxxx      |      5 | table             |
 public     | smtxxx            |      4 | foreign table     | oss_fdw
 public     | smtxxxxx          |      4 | foreign table     | oss_fdw
 public     | view_xxxxxx       |     14 | materialized view |
(4 rows)

On V3.1 and later, check the reason field to understand why each table is missing statistics, and the autovacuum_enabled field to see whether Auto Analyze is configured for it.

Step 3: Run ANALYZE

Run ANALYZE on the tables that need statistics. The following example analyzes a single table.

ANALYZE spatialxxxxx;

Repeat for each table returned by the view.

Step 4: Verify the result

Return to Monitoring Information in the Hologres Management Console. The Number of tables missing DB statistics metric should decrease.

Monitoring console after running ANALYZE, showing a decrease in the metric