approximate_row_count depends on the database having up-to-date statistics about the table or
, which are updated by VACUUM, ANALYZE, and a few DDL commands. If you have auto-vacuum configured on
your table or , or changes to the table are relatively infrequent, you might not need to explicitly
ANALYZE your table as shown below. Otherwise, if your table statistics are too out-of-date, running this command
updates your statistics and yields more accurate approximation results.
Samples
Get the approximate row count for a single .Arguments
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
relation | REGCLASS | - | ✔ | or regular table to get row count for. |