explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 3WuF

Settings
# exclusive inclusive rows x rows loops node
1. 196.371 34,517.301 ↑ 508.2 12,700 1

GroupAggregate (cost=17,788,196.05..18,723,985.78 rows=6,453,722 width=58) (actual time=34,111.465..34,517.301 rows=12,700 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. 886.940 34,320.930 ↑ 157.3 410,219 1

Sort (cost=17,788,196.05..17,949,539.11 rows=64,537,223 width=50) (actual time=34,111.438..34,320.930 rows=410,219 loops=1)

  • 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: 17768kB
3. 16,410.670 33,433.990 ↑ 157.3 410,219 1

Hash Join (cost=29,572.69..2,798,953.97 rows=64,537,223 width=50) (actual time=2,362.214..33,433.990 rows=410,219 loops=1)

  • Hash Cond: (viewers.stream_id = streams.id)
4. 16,920.448 16,920.448 ↓ 1.0 64,537,706 1

Seq Scan on viewers (cost=0.00..1,236,622.23 rows=64,537,223 width=26) (actual time=0.009..16,920.448 rows=64,537,706 loops=1)

5. 1.099 102.872 ↑ 8.2 3,170 1

Hash (cost=29,247.53..29,247.53 rows=26,013 width=8) (actual time=102.872..102.872 rows=3,170 loops=1)

  • Buckets: 32768 Batches: 1 Memory Usage: 380kB
6. 27.510 101.773 ↑ 8.2 3,170 1

HashAggregate (cost=28,987.40..29,247.53 rows=26,013 width=8) (actual time=100.047..101.773 rows=3,170 loops=1)

  • Group Key: streams.id
7. 12.606 74.263 ↓ 1.1 48,364 1

Gather (cost=1,000.00..28,872.85 rows=45,822 width=8) (actual time=46.311..74.263 rows=48,364 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
8. 61.657 61.657 ↑ 1.2 16,121 3

Parallel Seq Scan on streams (cost=0.00..23,290.65 rows=19,092 width=8) (actual time=43.985..61.657 rows=16,121 loops=3)

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