Senior
What is the measure of 'cost' in EXPLAIN? What is 'cost'?
sobes.tech AI
Answer from AI
In the EXPLAIN output in PostgreSQL (and other DBMS), the cost parameter is an estimate of the execution cost of a query or its part. It is measured in arbitrary units that reflect the amount of resources (CPU time, input-output operations, etc.) needed to perform the operation.
cost consists of two numbers: the startup cost and the total cost. The startup cost is the expense before the first rows are returned, and the total cost is the expense to return all rows.
These values do not have a direct physical measurement but serve the query planner to select the most efficient execution plan.