explain.depesz.com

PostgreSQL's explain analyze made readable

Result: X1wp

Settings
# exclusive inclusive rows x rows loops node
1. 11.074 612.323 ↓ 29.1 2,296 1

HashAggregate (cost=62,769.58..468,824.53 rows=79 width=24) (actual time=83.054..612.323 rows=2,296 loops=1)

  • Group Key: bs.id
  • Filter: (count(bsd.id) = (SubPlan 1))
  • Rows Removed by Filter: 2,018
2. 7.610 74.941 ↑ 2.6 30,660 1

Nested Loop (cost=1.13..62,376.13 rows=78,690 width=28) (actual time=0.084..74.941 rows=30,660 loops=1)

3. 23.911 23.911 ↑ 3.7 4,342 1

Index Scan using betslips_status_create_date_idx on betslips bs (cost=0.56..14,865.71 rows=15,887 width=24) (actual time=0.062..23.911 rows=4,342 loops=1)

  • Index Cond: ((status = 'Waiting'::betslip_status_type) AND (create_date < (now() - '00:10:00'::interval)))
4. 43.420 43.420 ↑ 1.1 7 4,342

Index Scan using betslip_detail_betslip_id_idx on betslip_detail bsd (cost=0.56..2.91 rows=8 width=8) (actual time=0.004..0.010 rows=7 loops=4,342)

  • Index Cond: (betslip_id = bs.id)
5.          

SubPlan (for HashAggregate)

6. 4.314 526.308 ↑ 1.0 1 4,314

Aggregate (cost=25.54..25.55 rows=1 width=8) (actual time=0.122..0.122 rows=1 loops=4,314)

7. 14.640 521.994 ↑ 1.3 6 4,314

Nested Loop (cost=3.36..25.52 rows=8 width=0) (actual time=0.027..0.121 rows=6 loops=4,314)

8. 47.454 47.454 ↑ 1.1 7 4,314

Index Scan using betslip_detail_betslip_id_idx on betslip_detail (cost=0.56..2.94 rows=8 width=8) (actual time=0.005..0.011 rows=7 loops=4,314)

  • Index Cond: (betslip_id = bs.id)
9. 0.000 459.900 ↑ 1.0 1 30,660

Subquery Scan on mo (cost=2.79..2.81 rows=1 width=0) (actual time=0.015..0.015 rows=1 loops=30,660)

  • Filter: (mo.outcome_result <> 1)
  • Rows Removed by Filter: 0
10. 30.660 459.900 ↑ 1.0 1 30,660

Limit (cost=2.79..2.80 rows=1 width=596) (actual time=0.015..0.015 rows=1 loops=30,660)

11. 91.980 429.240 ↑ 1.0 1 30,660

Sort (cost=2.79..2.80 rows=1 width=596) (actual time=0.014..0.014 rows=1 loops=30,660)

  • Sort Key: market_outcomes.create_date DESC
  • Sort Method: top-N heapsort Memory: 25kB
12. 337.260 337.260 ↓ 9.0 9 30,660

Index Scan using market_outcomes_market_id_outcome_no_fixed_odds_idx on market_outcomes (cost=0.56..2.78 rows=1 width=596) (actual time=0.004..0.011 rows=9 loops=30,660)

  • Index Cond: ((market_id = betslip_detail.market_id) AND (outcome_no = betslip_detail.outcome_no))