PostgreSQL - Execution plan - Actual time meaning 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:


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
­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­-&gt; 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
   -&gt; 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 ms


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?
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.