RefLib

Reference library for AI

Back

postgresql_16:7.1.146.4 Notes

PostgreSQL 16 > Reference > SQL Commands > EXPLAIN > Notes

In order to allow the PostgreSQL query planner to make reasonably informed decisions when optimizing queries, the pg_statistic (see postgresql_16:8.2.51) data should be up-to-date for all tables used in the query. Normally the autovacuum daemon (see postgresql_16:4.10.1.6) will take care of that automatically. But if a table has recently had substantial changes in its contents, you might need to do a manual ANALYZE (see postgresql_16:7.1.44) rather than wait for autovacuum to catch up with the changes.

In order to measure the run-time cost of each node in the execution plan, the current implementation of EXPLAIN ANALYZE adds profiling overhead to query execution. As a result, running EXPLAIN ANALYZE on a query can sometimes take significantly longer than executing the query normally. The amount of overhead depends on the nature of the query, as well as the platform being used. The worst case occurs for plan nodes that in themselves require very little time per execution, and on machines that have relatively slow operating system calls for obtaining the time of day.

Back