The HOLOGRES_STATISTIC.HG_STATS_MISSING view lists the tables in the current database that are missing statistics.
You can use this view to:
View tables with missing statistics. Missing statistics may cause the optimizer to generate poor execution plans, such as an incorrect join order that triggers large-table shuffles, slow queries, or out-of-memory (OOM) errors.
View the specific tables corresponding to the Stats Miss Table Num by DB metric in Hologres monitoring.
Selectively run manual ANALYZE or other governance operations on the tables that are missing statistics.
Limits
Your Hologres instance must run V2.2.15 or later.
A query returns only the tables in schemas on which the querying user has the SCHEMA USAGE permission or higher.
Table types other than internal Hologres tables, partitioned tables, foreign tables, and materialized views are not displayed (and are also excluded from the metric).
Fields
The following table describes the fields of the HOLOGRES_STATISTIC.HG_STATS_MISSING view.
Field | Data type | Description |
schemaname | TEXT | Schema name. |
tablename | TEXT | Table name. |
nattrs | INTEGER | Number of columns. |
tablekind | TEXT | Table type (for example, table or foreign_table). |
fdwname | TEXT | Foreign data wrapper (FDW) name. Populated for foreign tables only. |
autovacuum_enabled | TEXT | Whether Auto Analyze is enabled for the table. Note Available only in V3.1. |
reason | TEXT | The reason why statistics are missing. Use this field to determine the next action. Note Available only in V3.1. |
reason: classification of missing reasons
Reason | Category | Description | Recommended action |
| Column statistics missing | Statistics (such as MCV and histogram) have not been collected for the specified column. | Run the |
| Column statistics missing | The HyperLogLog (HLL) counter is missing for the specified column. HLL is used to estimate the number of distinct values (NDV) of partition child tables and plays a key role in statistics merging for partitioned tables. | Run the |
| Logical partitioned table statistics cannot be merged | The logical partitioned table has child partitions whose statistics cannot be merged. This may be caused by missing or incompatible statistics in some child partitions. | Run the |
| Auto collection explicitly disabled | AUTO ANALYZE has been manually disabled for the table, so statistics are not automatically collected. | To re-enable automatic statistics maintenance, turn on table-level AUTO ANALYZE: |
| Type mismatch | The data type of the existing MCV (Most Common Values) or histogram statistics for the specified column does not match the current data type of the column. This typically occurs after the column type is modified. | Run the |
| Table-level exception | The table was deleted or became inaccessible during the statistics check. | No action required. The table no longer exists and subsequent queries automatically ignore it. |
Examples
In the instance list, click the instance ID to enter the instance details page. Click Group Name, select Binlog and Analyze, and view Stats Miss Table Num by DB.
Take one of the databases as an example to view the tables that are missing statistics in the current database.
SELECT * FROM hologres_statistic.hg_stats_missing;Sample output:
schemaname | tablename | nattrs | tablekind | fdwname | autovacuum_enabled | reason
------------------------------------+----------------------------------+--------+---------------+----------+--------------------+------------------------------
hologres_foreign_dataset_tpch_100g | odps_customer_100g | 8 | foreign table | odps_fdw | t | column "c_custkey" missing
hologres_foreign_dataset_tpch_100g | odps_nation_100g | 4 | foreign table | odps_fdw | t | column "n_nationkey" missing
hologres_foreign_dataset_tpch_100g | odps_orders_100g | 9 | foreign table | odps_fdw | t | column "o_orderkey" missing
hologres_foreign_dataset_tpch_100g | odps_part_100g | 9 | foreign table | odps_fdw | t | column "p_partkey" missing
hologres_foreign_dataset_tpch_100g | odps_lineitem_100g | 16 | foreign table | odps_fdw | t | column "l_orderkey" missing
public | spatialxxxxx | 5 | table | | t |
public | smtxxx | 4 | foreign table | oss_fdw | t |
public | smtxxxxx | 4 | foreign table | oss_fdw | t | You can then run ANALYZE manually on a table that is missing statistics.
ANALYZE spatialxxxxx;Return to the monitoring page. The Stats Miss Table Num by DB metric decreases.
FAQ
Q: Why does the number of rows returned by HG_STATS_MISSING exceed the count shown by the monitoring metric?
The two counts use different criteria.
Missing statistics fall into two types:
Both row count statistics and column statistics are completely missing.
Row count statistics are available and can be used for basic estimation in query plans, but detailed column statistics are missing (which only affects estimation accuracy).
The count of type (2) > the count of type (1).
As described in this topic, the number of rows returned by HG_STATS_MISSING includes the cases where column statistics are missing, which equals the count of type (2).
The Stats Miss Table Num by DB monitoring metric only shows tables whose statistics are completely missing, which equals the count of type (1).
Therefore, the number of rows returned by HG_STATS_MISSING >= the value of the Stats Miss Table Num by DB metric.