explain.depesz.com

PostgreSQL's explain analyze made readable

Result: t599

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.003 1.284 ↑ 1.0 1 1

Nested Loop (cost=0.55..5,885.29 rows=1 width=33) (actual time=1.283..1.284 rows=1 loops=1)

  • Join Filter: (cc.campaign_id = c.campaign_id)
2. 0.046 1.277 ↑ 1.0 1 1

Nested Loop (cost=0.28..5,884.67 rows=1 width=37) (actual time=1.276..1.277 rows=1 loops=1)

  • Join Filter: (cc.campaign_id = ct.campaign_id)
  • Rows Removed by Join Filter: 809
3. 0.009 0.009 ↓ 2.0 2 1

Index Only Scan using campaign_customer_pkey on campaign_customer cc (cost=0.28..4.29 rows=1 width=4) (actual time=0.009..0.009 rows=2 loops=1)

  • Index Cond: (customer_id = 388,244)
  • Heap Fetches: 2
4. 0.412 1.222 ↓ 3.0 405 2

Seq Scan on campaign_trigger ct (cost=0.00..5,878.72 rows=133 width=33) (actual time=0.034..0.611 rows=405 loops=2)

  • Filter: ((campaign_trigger_type_id = 9) AND ((campaign_trigger_max_award_count = '-1'::integer) OR (campaign_trigger_max_award_count > campaign_trigger_award_count)) AND ((campaign_trigger_max_customer_award_count = '-1'::integer) OR (campaign_trigger_max_customer_award_count > (SubPlan 1))))
  • Rows Removed by Filter: 947
5.          

SubPlan (for Seq Scan)

6. 0.000 0.810 ↑ 1.0 1 810

Aggregate (cost=4.31..4.32 rows=1 width=8) (actual time=0.001..0.001 rows=1 loops=810)

7. 0.810 0.810 ↓ 0.0 0 810

Index Only Scan using campaign_award_customer_id_index on campaign_award ca (cost=0.29..4.31 rows=1 width=0) (actual time=0.001..0.001 rows=0 loops=810)

  • Index Cond: ((campaign_trigger_id = ct.campaign_trigger_id) AND (customer_id = 388,244))
  • Heap Fetches: 0
8. 0.004 0.004 ↑ 1.0 1 1

Index Scan using campaign_pkey on campaign c (cost=0.28..0.61 rows=1 width=4) (actual time=0.004..0.004 rows=1 loops=1)

  • Index Cond: (campaign_id = ct.campaign_id)
  • Filter: (campaign_active AND (NOT campaign_global) AND (super_site_id = 16) AND (campaign_valid_from <= now()) AND (campaign_valid_to >= now()))
Planning time : 0.382 ms
Execution time : 1.357 ms