explain.depesz.com

PostgreSQL's explain analyze made readable

Result: RpkP

Settings
# exclusive inclusive rows x rows loops node
1. 13.719 346,287.455 ↑ 508.2 12,701 1

Finalize GroupAggregate (cost=8,739,922.35..10,853,718.07 rows=6,454,017 width=50) (actual time=346,048.310..346,287.455 rows=12,701 loops=1)

  • Group Key: viewers.name, (to_char((date_trunc('week'::text, (viewers.ts - '4 days'::interval)) + '4 days'::interval), 'YYYY-MM-DD'::text))
2. 0.000 346,273.736 ↑ 573.5 22,506 1

Gather Merge (cost=8,739,922.35..10,627,827.47 rows=12,908,034 width=50) (actual time=346,047.333..346,273.736 rows=22,506 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
3. 224.811 1,038,636.033 ↑ 860.3 7,502 3

Partial GroupAggregate (cost=8,738,922.33..9,136,920.05 rows=6,454,017 width=50) (actual time=346,032.632..346,212.011 rows=7,502 loops=3)

  • Group Key: viewers.name, (to_char((date_trunc('week'::text, (viewers.ts - '4 days'::interval)) + '4 days'::interval), 'YYYY-MM-DD'::text))
4. 1,671.111 1,038,411.222 ↑ 196.6 136,767 3

Sort (cost=8,738,922.33..8,806,151.67 rows=26,891,738 width=42) (actual time=346,032.424..346,137.074 rows=136,767 loops=3)

  • Sort Key: viewers.name, (to_char((date_trunc('week'::text, (viewers.ts - '4 days'::interval)) + '4 days'::interval), 'YYYY-MM-DD'::text))
  • Sort Method: external merge Disk: 4352kB
5. 18,599.655 1,036,740.111 ↑ 196.6 136,767 3

Merge Semi Join (cost=34,931.63..2,938,676.16 rows=26,891,738 width=42) (actual time=229,422.494..345,580.037 rows=136,767 loops=3)

  • Merge Cond: (viewers.stream_id = streams.id)
6. 1,017,391.026 1,017,391.026 ↑ 1.2 21,513,570 3

Parallel Index Scan using viewers_stream_idx on viewers (cost=0.56..2,098,295.39 rows=26,891,738 width=26) (actual time=3.755..339,130.342 rows=21,513,570 loops=3)

7. 149.847 749.430 ↓ 1.1 48,365 3

Sort (cost=34,930.29..35,044.85 rows=45,825 width=8) (actual time=231.055..249.810 rows=48,365 loops=3)

  • Sort Key: streams.id
  • Sort Method: quicksort Memory: 3633kB
8. 599.583 599.583 ↓ 1.1 48,375 3

Seq Scan on streams (cost=0.00..31,382.55 rows=45,825 width=8) (actual time=135.329..199.861 rows=48,375 loops=3)

  • Filter: (game = 2)
  • Rows Removed by Filter: 1061680