explain.depesz.com

PostgreSQL's explain analyze made readable

Result: iM5

Settings
# exclusive inclusive rows x rows loops node
1. 0.056 1,829.193 ↑ 36,176.2 9 1

Sort (cost=302,883.88..303,697.85 rows=325,586 width=383) (actual time=1,829.193..1,829.193 rows=9 loops=1)

  • Sort Key: y.betselectionid, z.betchoiceid
  • Sort Method: quicksort Memory: 29kB
2. 1,010.459 1,829.137 ↑ 36,176.2 9 1

Hash Right Join (cost=47,426.69..239,829.32 rows=325,586 width=383) (actual time=1,809.925..1,829.137 rows=9 loops=1)

  • Hash Cond: (mp.marketid = m.marketid)
3. 818.101 818.101 ↑ 1.0 3,404,313 1

Seq Scan on marketsprices mp (cost=0.00..71,196.28 rows=3,407,428 width=41) (actual time=0.023..818.101 rows=3,404,313 loops=1)

4. 0.095 0.577 ↑ 36,176.2 9 1

Hash (cost=28,412.86..28,412.86 rows=325,586 width=350) (actual time=0.577..0.577 rows=9 loops=1)

  • Buckets: 8192 Batches: 8 Memory Usage: 3kB
5. 0.015 0.482 ↑ 36,176.2 9 1

Merge Left Join (cost=22,712.76..28,412.86 rows=325,586 width=350) (actual time=0.473..0.482 rows=9 loops=1)

  • Merge Cond: (y.betselectionid = z.betselectionid)
  • Join Filter: (x.betid = z.betid)
6. 0.014 0.303 ↑ 469.0 1 1

Sort (cost=97.89..99.06 rows=469 width=313) (actual time=0.302..0.303 rows=1 loops=1)

  • Sort Key: y.betselectionid
  • Sort Method: quicksort Memory: 25kB
7. 0.005 0.289 ↑ 469.0 1 1

Nested Loop Left Join (cost=0.00..77.08 rows=469 width=313) (actual time=0.286..0.289 rows=1 loops=1)

  • Join Filter: (x.betid = y.betid)
8. 0.003 0.231 ↑ 1.0 1 1

Nested Loop Left Join (cost=0.00..18.71 rows=1 width=288) (actual time=0.229..0.231 rows=1 loops=1)

  • Join Filter: (x.betid = bp.betid)
9. 0.009 0.200 ↑ 1.0 1 1

Nested Loop Left Join (cost=0.00..16.23 rows=1 width=266) (actual time=0.198..0.200 rows=1 loops=1)

  • Join Filter: (x.betid = p.betid)
  • Filter: ((p.id = (SubPlan 2)) OR (NOT (alternatives: SubPlan 3 or hashed SubPlan 4)))
10. 0.002 0.119 ↑ 1.0 1 1

Nested Loop Left Join (cost=0.00..8.74 rows=1 width=256) (actual time=0.119..0.119 rows=1 loops=1)

  • Join Filter: (x.betid = ba.betid)
11. 0.107 0.107 ↑ 1.0 1 1

Nested Loop Left Join (cost=0.00..6.26 rows=1 width=176) (actual time=0.107..0.107 rows=1 loops=1)

  • Join Filter: (x.betid = i.betid)
  • -> Index Scan using pk_bets on bets x (cost=0.00..3.78 rows=1 width=171) (actual time=0.069..0.069
  • Index Cond: (betid = 97776914)
  • -> Index Scan using pk_betsinstantwinamounts on betsinstantwinamounts i (cost=0.00..2.47 rows=1 wi
  • Index Cond: (betid = 97776914)
12. 0.010 0.010 ↓ 0.0 0 1

Index Scan using betaams_pkey on betaamsdetails ba (cost=0.00..2.47 rows=1 width=84) (actual time=0.010..0.010 rows=0 loops=1)

13. 0.062 0.062 ↓ 0.0 0 1

Index Scan using pk_betspaymentauth on betspaymentauth p (cost=0.00..2.48 rows=1 width=16) (actual time=0.062..0.062 rows=0 loops=1)

  • Index Cond: (betid = 97776914)
14.          

SubPlan (forNested Loop Left Join)

15. 0.003 0.008 ↑ 1.0 1 1

Result (cost=2.49..2.50 rows=1 width=0) (actual time=0.008..0.008 rows=1 loops=1)

16.          

Initplan (forResult)

17. 0.001 0.005 ↓ 0.0 0 1

Limit (cost=0.00..2.49 rows=1 width=2) (actual time=0.005..0.005 rows=0 loops=1)

18. 0.004 0.004 ↓ 0.0 0 1

Index Scan Backward using pk_betspaymentauth on betspaymentauth bpa2 (cost=0.00..2.49 rows=1 width=2) (actual time=0.004..0.004 rows=0 loops=1)

  • Index Cond: ((betid = x.betid) AND (id IS NOT NULL))
19. 0.002 0.002 ↓ 0.0 0 1

Index Scan using pk_betspaymentauth on betspaymentauth bpa3 (cost=0.00..2.48 rows=1 width=0) (actual time=0.002..0.002 rows=0 loops=1)

  • Index Cond: (betid = x.betid)
20. 0.000 0.000 ↓ 0.0 0

Seq Scan on betspaymentauth bpa3 (cost=0.00..8,437.89 rows=434,689 width=4) (never executed)

21. 0.028 0.028 ↓ 0.0 0 1

Index Scan using pk_betspaid on betspaid bp (cost=0.00..2.47 rows=1 width=26) (actual time=0.028..0.028 rows=0 loops=1)

  • Index Cond: (betid = 97776914)
22. 0.053 0.053 ↑ 469.0 1 1

Index Scan using betselections_betid_idx on betselections y (cost=0.00..52.51 rows=469 width=29) (actual time=0.053..0.053 rows=1 loops=1)

  • Index Cond: (betid = 97776914)
23. 0.020 0.164 ↑ 647.1 9 1

Sort (cost=22,614.87..22,629.43 rows=5,824 width=43) (actual time=0.164..0.164 rows=9 loops=1)

  • Sort Key: z.betselectionid
  • Sort Method: quicksort Memory: 26kB
24. 0.013 0.144 ↑ 647.1 9 1

Nested Loop Left Join (cost=0.00..22,250.65 rows=5,824 width=43) (actual time=0.114..0.144 rows=9 loops=1)

25. 0.086 0.086 ↑ 647.1 9 1

Index Scan using betchoices_betid_idx on betchoices z (cost=0.00..345.98 rows=5,824 width=31) (actual time=0.084..0.086 rows=9 loops=1)

  • Index Cond: (betid = 97776914)
26. 0.045 0.045 ↑ 1.0 1 9

Index Scan using pk_markets on markets m (cost=0.00..3.74 rows=1 width=16) (actual time=0.005..0.005 rows=1 loops=9)

  • Index Cond: ((z.marketid = marketid) AND (z.marketid = marketid) AND (z.sequenceid = sequenceid))