

The PostgreSQL explain command has two options. EXPLAIN command is EXPLAIN ANALYZE VERBOSE query Let's start by looking at a simple example : perf EXPLAIN ANALYZE SELECT FROM recalls. PostgreSQL has other options to discover and analyze. The Oracle database’s execution plan only shows the second value. We also develop custom products for clients, always around Postgres.

The first is the cost for the startup, the second is the total cost for the execution if all rows are retrieved.

Note that PostgreSQL shows two cost values. The output has similar information as the Oracle execution plans shown throughout the book: the operation name (“Result”), the related cost, the row count estimate, and the expected row width. The explain plan output is as follows: QUERY PLAN If you use PostgreSQL 9.1 or earlier and bind parameters in your program, you should also use explain with bind parameters to retrieve the same execution plan. In this case, the optimizer has always considered the actual values during query planning. Deliver consistent database performance and availability through intelligent tuning advisors and continuous database profiling. With no parameter, ANALYZE examines every table in the current database. Subsequently, the query planner uses these statistics to help determine the most efficient execution plans for queries. Statements without bind parameters can be explained directly: EXPLAIN SELECT 1 ANALYZE collects statistics about the contents of tables in the database, and stores the results in the pgstatistic system catalog.
