explain.depesz.com

PostgreSQL's explain analyze made readable

Result: howE

Settings
# exclusive inclusive rows x rows loops node
1. 0.618 330.704 ↑ 11.2 704 1

WindowAgg (cost=24,340.76..24,756.40 rows=7,917 width=108) (actual time=330.070..330.704 rows=704 loops=1)

2.          

CTE a

3. 0.897 328.579 ↑ 11.2 704 1

WindowAgg (cost=20,296.83..23,036.41 rows=7,917 width=84) (actual time=325.135..328.579 rows=704 loops=1)

4. 1.389 327.682 ↑ 11.2 704 1

Finalize GroupAggregate (cost=20,296.83..22,739.52 rows=7,917 width=44) (actual time=325.117..327.682 rows=704 loops=1)

  • Group Key: service_data.service_data_id, (time_bucket('00:05:00'::interval, service_data.measured_at))
5. 0.720 326.293 ↑ 10.2 704 1

Gather Merge (cost=20,296.83..21,478.96 rows=7,146 width=268) (actual time=325.089..326.293 rows=704 loops=1)

  • Workers Planned: 2
  • Workers Launched: 0
6. 1.018 325.573 ↑ 5.1 704 1

Partial GroupAggregate (cost=19,296.81..19,654.11 rows=3,573 width=268) (actual time=324.525..325.573 rows=704 loops=1)

  • Group Key: service_data.service_data_id, (time_bucket('00:05:00'::interval, service_data.measured_at))
7. 0.490 324.555 ↑ 5.1 704 1

Sort (cost=19,296.81..19,305.74 rows=3,573 width=268) (actual time=324.504..324.555 rows=704 loops=1)

  • Sort Key: service_data.service_data_id, (time_bucket('00:05:00'::interval, service_data.measured_at))
  • Sort Method: quicksort Memory: 212kB
8. 324.065 324.065 ↑ 5.1 704 1

Parallel Seq Scan on service_data (cost=0.00..19,085.95 rows=3,573 width=268) (actual time=309.727..324.065 rows=704 loops=1)

  • Filter: ((time_bucket('00:05:00'::interval, measured_at) > (current_setting('snap.from_ts'::text))::timestamp without time zone) AND (service_data_id = ANY ((current_setting('snap.service_data_id'::text))::integer[])))
  • Rows Removed by Filter: 478,889
9.          

CTE b

10. 329.451 329.451 ↑ 11.2 704 1

CTE Scan on a (cost=0.00..633.36 rows=7,917 width=116) (actual time=325.140..329.451 rows=704 loops=1)

11. 0.203 330.086 ↑ 11.2 704 1

Sort (cost=670.99..690.79 rows=7,917 width=44) (actual time=330.059..330.086 rows=704 loops=1)

  • Sort Key: b.service_data_id, b.five_min
  • Sort Method: quicksort Memory: 80kB
12. 329.883 329.883 ↑ 11.2 704 1

CTE Scan on b (cost=0.00..158.34 rows=7,917 width=44) (actual time=325.143..329.883 rows=704 loops=1)

Planning time : 0.898 ms
Execution time : 331.106 ms