explain.depesz.com

PostgreSQL's explain analyze made readable

Result: tohT

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

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

2. 573.203 8,547.970 ↓ 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,736.417..8,547.970 rows=7,857,663 loops=1)

3. 998.294 7,974.767 ↓ 1.0 7,857,663 1

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

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

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

  • Hash Cond: (c.primary_doc_number = (t.primary_doc_number)::bpchar)
5. 1,954.007 1,954.007 ↓ 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.129..1,954.007 rows=7,857,663 loops=1)

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

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

  • Buckets: 65536 Batches: 128 Memory Usage: 3168kB
7. 907.055 907.055 ↑ 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.082..907.055 rows=5,351,204 loops=1)

8. 0.028 0.067 ↑ 1.0 5 1

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

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

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

10. 0.133 1.542 ↑ 1.6 265 1

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

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

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

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

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

13. 0.028 0.069 ↑ 1.0 289 1

Hash (cost=8.61..8.61 rows=289 width=24) (actual time=0.069..0.069 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.004..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)
Planning time : 3.108 ms
Execution time : 9,048.164 ms