explain.depesz.com

PostgreSQL's explain analyze made readable

Result: tMJB

Settings
# exclusive inclusive rows x rows loops node
1. 333.598 8,872.061 ↓ 1.0 7,857,928 1

Append (cost=271,076.20..1,042,970.05 rows=7,797,286 width=158) (actual time=1,731.402..8,872.061 rows=7,857,928 loops=1)

2. 574.902 8,536.993 ↓ 1.0 7,857,663 1

Subquery Scan on *SELECT* 1 (cost=271,076.20..1,042,549.55 rows=7,796,856 width=93) (actual time=1,731.401..8,536.993 rows=7,857,663 loops=1)

3. 981.060 7,962.091 ↓ 1.0 7,857,663 1

Hash Join (cost=271,076.20..945,088.85 rows=7,796,856 width=89) (actual time=1,731.399..7,962.091 rows=7,857,663 loops=1)

  • Hash Cond: (c.action = a.alp_action_id)
4. 3,414.089 6,981.006 ↓ 1.0 7,857,663 1

Hash Join (cost=271,075.09..908,522.05 rows=7,796,856 width=49) (actual time=1,731.341..6,981.006 rows=7,857,663 loops=1)

  • Hash Cond: (c.primary_doc_number = (t.primary_doc_number)::bpchar)
5. 1,836.411 1,836.411 ↓ 1.0 7,857,663 1

Seq Scan on alp_coupons c (cost=0.00..342,850.91 rows=7,796,856 width=30) (actual time=0.046..1,836.411 rows=7,857,663 loops=1)

  • Filter: ((points <> 0) AND ((coupon_status)::text = 'USED'::text))
  • Rows Removed by Filter: 2487664
6. 821.803 1,730.506 ↑ 1.0 5,351,204 1

Hash (cost=162,378.04..162,378.04 rows=5,351,204 width=33) (actual time=1,730.506..1,730.506 rows=5,351,204 loops=1)

  • Buckets: 65536 Batches: 128 Memory Usage: 3168kB
7. 908.703 908.703 ↑ 1.0 5,351,204 1

Seq Scan on alp_tickets t (cost=0.00..162,378.04 rows=5,351,204 width=33) (actual time=0.040..908.703 rows=5,351,204 loops=1)

8. 0.008 0.025 ↑ 1.0 5 1

Hash (cost=1.05..1.05 rows=5 width=36) (actual time=0.025..0.025 rows=5 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
9. 0.017 0.017 ↑ 1.0 5 1

Seq Scan on alp_actions a (cost=0.00..1.05 rows=5 width=36) (actual time=0.014..0.017 rows=5 loops=1)

10. 0.109 1.470 ↑ 1.6 265 1

Nested Loop (cost=12.51..416.20 rows=430 width=111) (actual time=0.101..1.470 rows=265 loops=1)

  • Join Filter: (c_1.user_id = a_1.agent_id)
11. 0.522 1.096 ↑ 1.1 265 1

Hash Join (cost=12.23..303.50 rows=289 width=48) (actual time=0.088..1.096 rows=265 loops=1)

  • Hash Cond: (u.agent_id = c_1.user_id)
12. 0.506 0.506 ↑ 1.0 8,630 1

Seq Scan on users u (cost=0.00..191.30 rows=8,630 width=24) (actual time=0.010..0.506 rows=8,630 loops=1)

13. 0.027 0.068 ↑ 1.0 289 1

Hash (cost=8.61..8.61 rows=289 width=24) (actual time=0.068..0.068 rows=289 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 24kB
14. 0.041 0.041 ↑ 1.0 289 1

Seq Scan on alp_charges c_1 (cost=0.00..8.61 rows=289 width=24) (actual time=0.003..0.041 rows=289 loops=1)

  • Filter: (is_automatic = '0'::bpchar)
15. 0.265 0.265 ↑ 1.0 1 265

Index Scan using agents_pkey on agents a_1 (cost=0.28..0.36 rows=1 width=15) (actual time=0.001..0.001 rows=1 loops=265)

  • Index Cond: (agent_id = u.agent_id)