explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Nm3x

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 0.036 ↑ 1.0 1 1

Nested Loop (cost=0.83..13.55 rows=1 width=33) (actual time=0.036..0.036 rows=1 loops=1)

  • Join Filter: (cc.campaign_id = c.campaign_id)
2. 0.002 0.033 ↑ 1.0 1 1

Nested Loop (cost=0.55..12.93 rows=1 width=37) (actual time=0.033..0.033 rows=1 loops=1)

3. 0.011 0.011 ↓ 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.010..0.011 rows=2 loops=1)

  • Index Cond: (customer_id = 388,244)
  • Heap Fetches: 2
4. 0.007 0.020 ↓ 0.0 0 2

Index Scan using idx_campaign_trigger_01 on campaign_trigger ct (cost=0.28..8.63 rows=1 width=33) (actual time=0.010..0.010 rows=0 loops=2)

  • Index Cond: (campaign_id = cc.campaign_id)
  • 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: 0
5.          

SubPlan (for Index Scan)

6. 0.006 0.013 ↑ 1.0 1 1

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

7. 0.007 0.007 ↓ 0.0 0 1

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.007..0.007 rows=0 loops=1)

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

Index Scan using campaign_pkey on campaign c (cost=0.28..0.61 rows=1 width=4) (actual time=0.003..0.003 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()))