explain.depesz.com

PostgreSQL's explain analyze made readable

Result: okR6

Settings
# exclusive inclusive rows x rows loops node
1. 465.924 6,547.053 ↑ 3.5 265,053 1

Sort (cost=1,094,318.10..1,096,615.42 rows=918,927 width=1,329) (actual time=6,481.197..6,547.053 rows=265,053 loops=1)

  • Sort Key: events_archive.date
  • Sort Method: quicksort Memory: 243,377kB
2. 171.382 6,081.129 ↑ 3.5 265,053 1

Hash Left Join (cost=403,447.65..469,350.76 rows=918,927 width=1,329) (actual time=5,468.942..6,081.129 rows=265,053 loops=1)

  • Hash Cond: ((events_archive.uid)::text = (eo.event_uid)::text)
3. 155.206 5,869.851 ↑ 2.1 237,354 1

Hash Left Join (cost=398,744.14..417,301.73 rows=508,750 width=1,263) (actual time=5,428.824..5,869.851 rows=237,354 loops=1)

  • Hash Cond: ((events_archive.uid)::text = (em.event_uid)::text)
4. 108.208 5,684.865 ↑ 2.1 237,354 1

Hash Join (cost=395,586.02..412,808.08 rows=508,750 width=1,111) (actual time=5,398.844..5,684.865 rows=237,354 loops=1)

  • Hash Cond: (events_archive.organization_id = org.id)
5. 535.087 5,576.477 ↑ 3.2 237,354 1

HashAggregate (cost=395,571.96..403,165.25 rows=759,329 width=794) (actual time=5,398.653..5,576.477 rows=237,354 loops=1)

  • Group Key: events_archive.uid, events_archive.chain_hash, events_archive.init_point_id, events_archive.date, events_archive.""time"", events_archive.point_from_ids, events_archive.point_to_ids, events_archive.organization_id, events_archive.created_at, events_archive.updated_at, events_archive.is_imported, events_archive.is_fbs, events_archive.autorepeat_hash
6. 22.692 5,041.390 ↑ 3.2 237,354 1

Append (cost=0.00..370,893.77 rows=759,329 width=794) (actual time=0.007..5,041.390 rows=237,354 loops=1)

7. 12.476 12.476 ↑ 1.0 67,548 1

Seq Scan on events_archive (cost=0.00..3,283.48 rows=67,548 width=263) (actual time=0.006..12.476 rows=67,548 loops=1)

8. 28.665 5,006.222 ↑ 4.1 169,806 1

Subquery Scan on "*SELECT* 2" (cost=321,969.04..366,934.81 rows=691,781 width=213) (actual time=3,946.946..5,006.222 rows=169,806 loops=1)

9. 953.919 4,977.557 ↑ 4.1 169,806 1

GroupAggregate (cost=321,969.04..360,017.00 rows=691,781 width=221) (actual time=3,946.944..4,977.557 rows=169,806 loops=1)

  • Group Key: o.event_uid, o.chain_hash, o.date_from, o.organization_id, o.init_point_id, o.is_imported, o.is_fbs, o.autorepeat_hash
10. 1,600.196 4,023.638 ↑ 1.0 666,902 1

Sort (cost=321,969.04..323,698.50 rows=691,781 width=157) (actual time=3,946.905..4,023.638 rows=666,902 loops=1)

  • Sort Key: o.event_uid, o.chain_hash, o.date_from, o.organization_id, o.init_point_id, o.is_imported, o.is_fbs, o.autorepeat_hash
  • Sort Method: quicksort Memory: 201,722kB
11. 184.588 2,423.442 ↑ 1.0 666,902 1

Hash Join (cost=4,533.98..254,866.44 rows=691,781 width=157) (actual time=31.200..2,423.442 rows=666,902 loops=1)

  • Hash Cond: (o.point_to_id = pt.id)
12. 231.529 2,223.212 ↑ 1.0 666,902 1

Hash Join (cost=2,266.99..250,783.37 rows=691,781 width=157) (actual time=15.168..2,223.212 rows=666,902 loops=1)

  • Hash Cond: (o.point_from_id = p.id)
13. 1,976.941 1,976.941 ↑ 1.0 666,902 1

Seq Scan on org_schedule_calendar o (cost=0.00..246,700.29 rows=691,781 width=157) (actual time=0.040..1,976.941 rows=666,902 loops=1)

  • Filter: (is_active AND (event_uid IS NOT NULL) AND (init_point_id IS NOT NULL) AND (date_from >= (CURRENT_TIMESTAMP - '30 days'::interval)))
  • Rows Removed by Filter: 1,694,592
14. 6.518 14.742 ↑ 1.4 35,784 1

Hash (cost=1,640.33..1,640.33 rows=50,133 width=8) (actual time=14.742..14.742 rows=35,784 loops=1)

  • Buckets: 65,536 Batches: 1 Memory Usage: 1,910kB
15. 8.224 8.224 ↑ 1.4 35,784 1

Seq Scan on valid_point p (cost=0.00..1,640.33 rows=50,133 width=8) (actual time=0.006..8.224 rows=35,784 loops=1)

  • Filter: (NOT is_deleted)
16. 6.376 15.642 ↑ 1.4 35,784 1

Hash (cost=1,640.33..1,640.33 rows=50,133 width=8) (actual time=15.642..15.642 rows=35,784 loops=1)

  • Buckets: 65,536 Batches: 1 Memory Usage: 1,910kB
17. 9.266 9.266 ↑ 1.4 35,784 1

Seq Scan on valid_point pt (cost=0.00..1,640.33 rows=50,133 width=8) (actual time=0.009..9.266 rows=35,784 loops=1)

  • Filter: (NOT is_deleted)
18. 0.064 0.180 ↓ 1.0 138 1

Hash (cost=12.38..12.38 rows=134 width=317) (actual time=0.180..0.180 rows=138 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 57kB
19. 0.116 0.116 ↓ 1.0 138 1

Seq Scan on organization org (cost=0.00..12.38 rows=134 width=317) (actual time=0.016..0.116 rows=138 loops=1)

  • Filter: (NOT is_deleted)
  • Rows Removed by Filter: 4
20. 17.534 29.780 ↑ 1.0 80,344 1

Hash (cost=2,153.61..2,153.61 rows=80,361 width=152) (actual time=29.780..29.780 rows=80,344 loops=1)

  • Buckets: 131,072 Batches: 1 Memory Usage: 11,428kB
21. 12.246 12.246 ↑ 1.0 80,344 1

Seq Scan on event_meta em (cost=0.00..2,153.61 rows=80,361 width=152) (actual time=0.014..12.246 rows=80,344 loops=1)

22. 27.346 39.896 ↓ 1.0 103,538 1

Hash (cost=3,416.56..3,416.56 rows=102,956 width=58) (actual time=39.896..39.896 rows=103,538 loops=1)

  • Buckets: 131,072 Batches: 1 Memory Usage: 11,540kB
23. 12.550 12.550 ↓ 1.0 103,538 1

Seq Scan on event_orders eo (cost=0.00..3,416.56 rows=102,956 width=58) (actual time=0.009..12.550 rows=103,538 loops=1)

Planning time : 1.166 ms
Execution time : 6,723.813 ms