This topic describes the HG_STATS_MISSING view in Hologres databases. The view contains information about tables for which no statistical information is collected. This topic also provides an example on how to query the HG_STATS_MISSING view and obtain the details and number of tables. You can perform data governance on tables and query the view again to observe the metric changes of the tables.
You can perform the following operations based on the view:
View tables for which no statistical information is collected. These tables may result in poor execution plans. For example, an inverted join order may lead to a substantial shuffle of large tables, which causes issues such as slow computing speed and out of memory (OOM) errors.
View the details of tables collected by the Stats Miss Table Num by DB(countS) metric in Hologres.
Execute ANALYZE statements on specific tables for which no statistical information is collected.
Limits
The version of your Hologres instance must be V2.2.15 or later.
You can query only tables in the schemas on which your account has the SCHEMA USAGE permission or higher permissions.
The view can return only the following types of tables: single tables, partitioned tables, foreign tables, and materialized views. Other types of tables are not counted in the related metric.
Field description
The following table describes the fields in the HOLOGRES_STATISTIC.HG_STATS_MISSING view.
Field | Data type | Description |
schemaname | TEXT | The name of the schema. |
tablename | TEXT | The name of the table. |
nattrs | INTEGER | The number of columns. |
tablekind | TEXT | The table type, such as internal table or foreign table. |
fdwname | TEXT | The name of the foreign data wrapper (FDW) for a foreign table. |
Example
The Stats Miss Table Num by DB(countS) metric shows the number of tables for which no statistical information is collected in specific databases. To view information about these tables, perform the following steps: Log on to the Hologres console. In the left-side navigation pane, click Instances. On the Instances page, find the instance that you want to manage and click the name of the instance. On the details page of the instance, click Monitoring Information in the left-side navigation pane.
In this example, execute the following statement to view the tables for which no statistical information is collected in the current database:
SELECT * FROM hologres_statistic.hg_stats_missing;
The following output is returned:
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)
Execute the ANALYZE statement on a table returned by the view to collect the latest statistical information of the table.
ANALYZE spatialxxxxx;
On the Monitoring Information page, the value of the Stats Miss Table Num by DB(countS) metric decreases.