explain.depesz.com

A tool for finding a real cause for slow queries.

Result: wTt

options
Did it help? Consider supporting us - Bitcoin address: 12v2hUztAk2LgzQ9H9LMwuU32urHMjZQnq
# exclusive inclusive rows x rows loops node
1. 1.466 2,662.026 ↓ 142.7 428 1

Nested Loop Left Join (cost=10,000,001,523.32..3,660,000,537,256.79 rows=3 width=1,692) (actual time=13.881..2,662.026 rows=428 loops=1)

2. 622.239 623.732 ↓ 180.0 180 1

Nested Loop (cost=10,000,001,523.32..3,660,000,528,699.67 rows=1 width=1,427) (actual time=6.687..623.732 rows=180 loops=1)

  • Join Filter: (e.id = m.event_id)
3. 0.211 0.593 ↑ 1.0 180 1

Bitmap Heap Scan on events e (cost=82.24..295.35 rows=183 width=767) (actual time=0.404..0.593 rows=180 loops=1)

  • Recheck Cond: (id = ANY ('{60313,61093,60995,61147,60361,60890,61098,61096,61197,61144,60621,60309,60318,61152,60364,60465,61252,60887,61248,60625,61249,60467,60836,61094,60683,60784,59198,60314,60937,60892,60369,60785,59196,60786,60679,604
4. 0.382 0.382 ↑ 1.0 180 1

Bitmap Index Scan on events_pkey (cost=0.00..82.20 rows=183 width=0) (actual time=0.382..0.382 rows=180 loops=1)

  • Index Cond: (id = ANY ('{60313,61093,60995,61147,60361,60890,61098,61096,61197,61144,60621,60309,60318,61152,60364,60465,61252,60887,61248,60625,61249,60467,60836,61094,60683,60784,59198,60314,60937,60892,60369,60785,59196,60786,60679
5. 0.000 0.900 ↑ 1.0 1 180

Index Scan using markets_pkey on markets m (cost=10,000,001,441.08..10,000,001,446.36 rows=1 width=664) (actual time=0.004..0.005 rows=1 loops=180)

  • Index Cond: (m.id = (SubPlan 2))
6.          

SubPlan (forIndex Scan)

7. 0.180 621.360 ↑ 1.0 1 180

Limit (cost=10,000,001,441.08..10,000,001,441.08 rows=1 width=8) (actual time=3.452..3.452 rows=1 loops=180)

8. 1.620 621.180 ↑ 11.0 1 180

Sort (cost=10,000,001,441.08..10,000,001,441.11 rows=11 width=8) (actual time=3.451..3.451 rows=1 loops=180)

  • Sort Key: public.markets.index
  • Sort Method: quicksort Memory: 25kB
9. 619.560 619.560 ↑ 1.1 10 180

Seq Scan on markets (cost=10,000,000,000.00..10,000,001,441.02 rows=11 width=8) (actual time=2.224..3.442 rows=10 loops=180)

  • Filter: (active AND displayed AND (event_id = $0))
10. 0.180 621.360 ↑ 1.0 1 180

Limit (cost=10,000,001,441.08..10,000,001,441.08 rows=1 width=8) (actual time=3.452..3.452 rows=1 loops=180)

11. 1.620 621.180 ↑ 11.0 1 180

Sort (cost=10,000,001,441.08..10,000,001,441.11 rows=11 width=8) (actual time=3.451..3.451 rows=1 loops=180)

  • Sort Key: public.markets.index
  • Sort Method: quicksort Memory: 25kB
12. 619.560 619.560 ↑ 1.1 10 180

Seq Scan on markets (cost=10,000,000,000.00..10,000,001,441.02 rows=11 width=8) (actual time=2.224..3.442 rows=10 loops=180)

  • Filter: (active AND displayed AND (event_id = $0))
13. 1.260 1.260 ↑ 2.5 2 180

Index Scan using outcomes_market_id_active_index on outcomes o (cost=0.00..1.19 rows=5 width=269) (actual time=0.005..0.007 rows=2 loops=180)

  • Index Cond: (o.market_id = m.id)
14.          

SubPlan (forNested Loop Left Join)

15. 8.560 2,035.568 ↑ 1.0 1 428

Aggregate (cost=2,851.94..2,851.95 rows=1 width=4) (actual time=4.756..4.756 rows=1 loops=428)

16. 12.342 2,027.008 ↑ 1.1 52 428

Nested Loop (cost=0.00..2,851.80 rows=55 width=4) (actual time=3.202..4.736 rows=52 loops=428)

17. 1,998.760 1,998.760 ↓ 1.1 12 428

Index Scan using markets_pkey on markets (cost=0.00..2,717.60 rows=11 width=4) (actual time=3.197..4.670 rows=12 loops=428)

  • Filter: (active AND displayed AND (event_id = $0))
18. 15.906 15.906 ↑ 1.2 4 5,302

Index Scan using outcomes_market_id_active_index on outcomes (cost=0.00..12.14 rows=5 width=4) (actual time=0.002..0.003 rows=4 loops=5,302)

  • Index Cond: (outcomes.market_id = public.markets.id)