explain.depesz.com

PostgreSQL's explain analyze made readable

Result: sZXoF : Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: plan #ACWQ; plan #ABXd; plan #oySW; plan #S5kK; plan #s1mw

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 356.019 722.397 ↓ 23.7 62,581 1

WindowAgg (cost=8,255.46..8,976.49 rows=2,646 width=355) (actual time=337.369..722.397 rows=62,581 loops=1)

2. 161.744 366.378 ↓ 23.7 62,581 1

Sort (cost=8,255.46..8,262.07 rows=2,646 width=328) (actual time=337.171..366.378 rows=62,581 loops=1)

  • Sort Key: e.lease_interval_id, ((e.company_employee_id IS NOT NULL)), e.event_datetime
  • Sort Method: quicksort Memory: 37667kB
3. 38.397 204.634 ↓ 23.7 62,581 1

Hash Left Join (cost=90.65..8,105.04 rows=2,646 width=328) (actual time=0.305..204.634 rows=62,581 loops=1)

  • Hash Cond: ((e.cid = ce.cid) AND (e.company_employee_id = ce.id))
4. 24.158 166.023 ↓ 23.7 62,581 1

Nested Loop (cost=1.76..8,002.25 rows=2,646 width=318) (actual time=0.072..166.023 rows=62,581 loops=1)

5. 0.041 0.053 ↑ 1.0 22 1

HashAggregate (cost=1.33..1.55 rows=22 width=4) (actual time=0.024..0.053 rows=22 loops=1)

  • Group Key: load_prop.property_id
6. 0.012 0.012 ↑ 1.0 22 1

Seq Scan on load_prop (cost=0.00..1.27 rows=22 width=4) (actual time=0.006..0.012 rows=22 loops=1)

  • Filter: (cid = 16033)
7. 141.812 141.812 ↓ 23.7 2,845 22

Index Scan using idx_events_s1314 on events e (cost=0.43..362.47 rows=120 width=322) (actual time=0.012..6.446 rows=2,845 loops=22)

  • Index Cond: ((cid = 16033) AND (property_id = load_prop.property_id))
  • Filter: ((NOT is_deleted) AND (ps_product_id IS DISTINCT FROM 28))
  • Rows Removed by Filter: 460
8. 0.048 0.214 ↑ 1.0 99 1

Hash (cost=87.41..87.41 rows=99 width=21) (actual time=0.214..0.214 rows=99 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 14kB
9. 0.130 0.166 ↑ 1.0 99 1

Bitmap Heap Scan on company_employees ce (cost=5.05..87.41 rows=99 width=21) (actual time=0.048..0.166 rows=99 loops=1)

  • Recheck Cond: (cid = 16033)
  • Heap Blocks: exact=32
10. 0.036 0.036 ↑ 1.0 99 1

Bitmap Index Scan on uk_company_employees_cid_remote_primary_key (cost=0.00..5.02 rows=99 width=0) (actual time=0.036..0.036 rows=99 loops=1)

  • Index Cond: (cid = 16033)