explain.depesz.com

PostgreSQL's explain analyze made readable

Result: CiDg

Settings
# exclusive inclusive rows x rows loops node
1. 64.297 1,002.393 ↓ 1.9 25 1

Limit (cost=58,695.79..58,697.29 rows=13 width=282) (actual time=923.301..1,002.393 rows=25 loops=1)

  • Functions: 89
  • Options: Inlining false, Optimization false, Expressions true, Deforming true
  • Timing: Generation 11.203 ms, Inlining 0.000 ms, Optimization 5.400 ms, Emission 98.579 ms, Total 115.183 ms
2. 0.000 938.096 ↓ 1.9 25 1

Gather Merge (cost=58,695.79..58,697.29 rows=13 width=282) (actual time=859.008..938.096 rows=25 loops=1)

  • Workers Planned: 1
  • Workers Launched: 1
3. 6.350 1,667.420 ↓ 1.9 25 2

Sort (cost=57,695.78..57,695.81 rows=13 width=282) (actual time=833.709..833.710 rows=25 loops=2)

  • Sort Key: s.created_at DESC
  • Sort Method: top-N heapsort Memory: 37kB
  • Worker 0: Sort Method: top-N heapsort Memory: 37kB
4. 6.902 1,661.070 ↓ 408.0 5,304 2

Hash Join (cost=5.75..57,695.54 rows=13 width=282) (actual time=22.454..830.535 rows=5,304 loops=2)

  • Hash Cond: ((urs.risk_group_id = rg.id) AND ((CASE WHEN ((urs.country_code)::text = ANY ('{NO,SE,FI,EE,IS}'::text[])) THEN urs.country_code ELSE 'ROW'::character varying END)::text = (crs.country_code)::text))
5. 4.934 1,654.010 ↓ 12.5 5,304 2

Nested Loop (cost=1.42..57,674.65 rows=424 width=203) (actual time=22.301..827.005 rows=5,304 loops=2)

6. 73.686 1,617.252 ↓ 12.5 5,304 2

Nested Loop (cost=1.00..57,487.45 rows=424 width=145) (actual time=22.265..808.626 rows=5,304 loops=2)

7. 292.326 292.326 ↓ 6.8 156,405 2

Parallel Index Scan Backward using selection_created_at_idx on selection s (cost=0.44..2,908.83 rows=23,029 width=86) (actual time=20.525..146.163 rows=156,405 loops=2)

  • Index Cond: ((created_at >= '2018-12-27 22:00:00+00'::timestamp with time zone) AND (created_at <= 'infinity'::timestamp with time zone))
  • Filter: ('PREMATCH'::text = (product)::text)
  • Rows Removed by Filter: 28511
8. 1,251.240 1,251.240 ↓ 0.0 0 312,810

Index Scan using selection_meta_test_selection_id_idx on selection_meta_test sm (cost=0.56..2.36 rows=1 width=59) (actual time=0.004..0.004 rows=0 loops=312,810)

  • Index Cond: (selection_id = s.id)
  • Filter: ((sport = ANY ('{77}'::integer[])) AND (total_stake_bc > '25'::numeric))
  • Rows Removed by Filter: 1
9. 31.824 31.824 ↑ 1.0 1 10,608

Index Scan using user_risk_settings_user_id_unique on user_risk_settings urs (cost=0.42..0.44 rows=1 width=58) (actual time=0.003..0.003 rows=1 loops=10,608)

  • Index Cond: ((user_id)::text = (sm.user_id)::text)
10. 0.044 0.158 ↑ 1.0 72 2

Hash (cost=3.25..3.25 rows=72 width=71) (actual time=0.079..0.079 rows=72 loops=2)

  • Buckets: 1024 Batches: 1 Memory Usage: 16kB
11. 0.054 0.114 ↑ 1.0 72 2

Hash Join (cost=1.27..3.25 rows=72 width=71) (actual time=0.033..0.057 rows=72 loops=2)

  • Hash Cond: (crs.risk_group_id = rg.id)
12. 0.040 0.040 ↑ 1.0 72 2

Seq Scan on country_risk_settings crs (cost=0.00..1.72 rows=72 width=46) (actual time=0.016..0.020 rows=72 loops=2)

13. 0.010 0.020 ↑ 1.0 12 2

Hash (cost=1.12..1.12 rows=12 width=25) (actual time=0.010..0.010 rows=12 loops=2)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
14. 0.010 0.010 ↑ 1.0 12 2

Seq Scan on risk_group rg (cost=0.00..1.12 rows=12 width=25) (actual time=0.004..0.005 rows=12 loops=2)