explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Q9OF : Optimization for: plan #EmL7

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.036 567.276 ↓ 28.0 28 1

Nested Loop (cost=0.84..70,066.76 rows=1 width=48) (actual time=566.447..567.276 rows=28 loops=1)

  • Join Filter: (cp.contract_id = cp1.contract_id)
2. 0.024 566.785 ↓ 35.0 35 1

Nested Loop (cost=0.42..70,063.85 rows=1 width=16) (actual time=566.435..566.785 rows=35 loops=1)

3. 566.425 566.425 ↓ 28.0 28 1

Seq Scan on contract_properties cp (cost=0.00..70,016.96 rows=1 width=4) (actual time=566.401..566.425 rows=28 loops=1)

  • Filter: ((ps_product_id = ANY ('{37,2}'::integer[])) AND (updated_by = 5849) AND ((deactivation_date IS NULL) OR (deactivation_date > now())) AND (date(updated_on) = date(now())))
  • Rows Removed by Filter: 1250453
4. 0.336 0.336 ↑ 1.0 1 28

Index Scan using idx_contract_products_contract_id on contract_products cp2 (cost=0.42..46.88 rows=1 width=12) (actual time=0.009..0.012 rows=1 loops=28)

  • Index Cond: (contract_id = cp.contract_id)
  • Filter: ((bundle_ps_product_id IS NOT NULL) AND (ps_product_id = 2))
  • Rows Removed by Filter: 25
5. 0.455 0.455 ↑ 1.0 1 35

Index Scan using idx_contract_products_contract_id on contract_products cp1 (cost=0.42..2.90 rows=1 width=12) (actual time=0.007..0.013 rows=1 loops=35)

  • Index Cond: (contract_id = cp2.contract_id)
  • Filter: ((bundle_ps_product_id IS NULL) AND (ps_product_id = 37))
  • Rows Removed by Filter: 46