Wednesday, September 8, 2021

How to analyze a table in PostgreSQL

Just like Oracle, PostgreSQL stores statistics about the tables in an internal table called pg_statistics. This is used by the query planner to determine the most efficient execution path. To gather fresh statistics on a table, use the following simple syntax:
\connect mydatabase

analyze verbose myschema.mytable;
Documentation here

No comments:

Post a Comment