patternsqlMinor
PostgreSQL - Execution plan - Actual time meaning
Viewed 0 times
postgresqlmeaningactualtimeplanexecution
Problem
I have a question regarding the meaning of actual time in an execution plan.
I read the following things but they seem to be contradictory:
Example:
According to the point 1, the sort operations takes (729 - 612) 117ms.
According to the point 2, the sort operation takes 618 ms.
Can anybody explain to me what I'm missing here?
I read the following things but they seem to be contradictory:
- The first value is the time to retrieve the first line and the seconds value is the time to retrieve the last line.
- When I want to know which operation takes a long time, I take the second value of actual time of the outer operation and the second value of actual time of the inner operation.
Example:
EXPLAIN (ANALYZE) SELECT * FROM foo ORDER BY c1;
QUERY PLAN
-> Sort(cost=172682.84..175182.84 rows=1000000 width=37)(actual time=612.793..729.135 rows=1000000 loops=1)
Sort Key: c1
Sort Method: external sort Disk: 45952kB
-> Seq Scan on foo (cost=0.00..18334.00 rows=1000000 width=37)(actual time=0.017..111.068 rows=1000000 loops=1)
Total runtime: 772.685 msAccording to the point 1, the sort operations takes (729 - 612) 117ms.
According to the point 2, the sort operation takes 618 ms.
Can anybody explain to me what I'm missing here?
Solution
Your assumption 1) is wrong.
The first time is the time it takes to initialize the step. The second time is the total time the step took (including child steps).
So the total time for the sort step is 729ms - 111ms of that were spent retrieving the data through a Seq Scan.
The first time is the time it takes to initialize the step. The second time is the total time the step took (including child steps).
So the total time for the sort step is 729ms - 111ms of that were spent retrieving the data through a Seq Scan.
Context
StackExchange Database Administrators Q#193508, answer score: 4
Revisions (0)
No revisions yet.