explain.depesz.com

PostgreSQL's explain analyze made readable

Result: OHs3l : Optimization for: plan #o3Jq

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 0.134 820.717 ↑ 1.0 1,000 1

Limit (cost=1.85..7,028.91 rows=1,000 width=64) (actual time=139.705..820.717 rows=1,000 loops=1)

2. 23.902 820.583 ↑ 674.2 1,000 1

Nested Loop (cost=1.85..4,737,303.96 rows=674,152 width=64) (actual time=139.704..820.583 rows=1,000 loops=1)

3. 38.508 640.786 ↑ 29.1 51,965 1

Nested Loop (cost=1.42..4,039,002.60 rows=1,512,202 width=68) (actual time=139.131..640.786 rows=51,965 loops=1)

4. 17.251 446.383 ↑ 42.2 51,965 1

Nested Loop (cost=0.86..1,622,877.85 rows=2,194,247 width=64) (actual time=139.113..446.383 rows=51,965 loops=1)

5. 273.237 273.237 ↑ 57.7 51,965 1

Index Scan using card_expirations_pkey on card_expirations (cost=0.43..254,344.46 rows=3,000,336 width=64) (actual time=139.088..273.237 rows=51,965 loops=1)

  • Filter: ((deleted_at IS NULL) AND (expired_at IS NULL) AND (should_expire_at <= now()))
  • Rows Removed by Filter: 426,543
6. 155.895 155.895 ↑ 1.0 1 51,965

Index Scan using repos_pkey on repos (cost=0.42..0.46 rows=1 width=4) (actual time=0.003..0.003 rows=1 loops=51,965)

  • Index Cond: (id = card_expirations.repo_id)
  • Filter: (deleted_at IS NULL)
7. 155.895 155.895 ↑ 1.0 1 51,965

Index Scan using cards_pkey on cards (cost=0.56..1.10 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=51,965)

  • Index Cond: (id = card_expirations.card_id)
  • Filter: ((deleted_at IS NULL) AND (started_at IS NOT NULL))
8. 155.895 155.895 ↓ 0.0 0 51,965

Index Scan using phases_pkey on phases (cost=0.43..0.46 rows=1 width=4) (actual time=0.003..0.003 rows=0 loops=51,965)

  • Index Cond: (id = cards.current_phase_id)
  • Filter: ((deleted_at IS NULL) AND (done IS NOT TRUE) AND (index > '0'::numeric))
  • Rows Removed by Filter: 1
Planning time : 1.132 ms
Execution time : 820.874 ms