May 17, 2026, 11:40 PM

This commit is contained in:
Paweł Domański
2026-05-18 06:40:19 +00:00
commit 64944cf004
896 changed files with 310709 additions and 0 deletions
@@ -0,0 +1,37 @@
-- Analyze stats for a table testanalyze(schema is public)
dbaclass=# analyze testanalyze;
ANALYZE
-- For analyzing selected columns for emptab table ( schema is dbatest)
dbaclass=# analyze dbatest.emptab (datname,datdba);
ANALYZE
dbaclass=# select relname,reltuples from pg_class where relname in ('testanalyze','emptab');
relname | reltuples
-------------+-----------
testanalyze | 4
emptab | 4
(2 rows)
dbaclass=# select schemaname,relname,analyze_count,last_analyze,last_autoanalyze from pg_stat_user_tables where relname in ('testanalyze','emptab');
schemaname | relname | analyze_count | last_analyze | last_autoanalyze
------------+-------------+---------------+----------------------------------+------------------
public | testanalyze | 1 | 2020-07-21 17:00:49.687053+05:30 |
dbatest | emptab | 1 | 2020-07-21 17:10:01.111517+05:30 |
(2 rows)
---Analyze command with verbose command
dbaclass=# analyze verbose dbatest.emptab (datname,datdba);
INFO: analyzing "dbatest.emptab"
INFO: "emptab": scanned 1 of 1 pages, containing 4 live rows and 0 dead rows; 4 rows in sample, 4 estimated total rows
ANALYZE
---Analyze tables in the current schema that the user has access to.
dbaclass=# analyze ;