explain.depesz.com

PostgreSQL's explain analyze made readable

Result: o3Jq

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.001 63,494.824 ↑ 1,000.0 1 1

Limit (cost=1.85..18,515.67 rows=1,000 width=64) (actual time=49,296.857..63,494.824 rows=1 loops=1)

2. 2,331.655 63,494.823 ↑ 111,152.0 1 1

Nested Loop (cost=1.85..2,057,849.33 rows=111,152 width=64) (actual time=49,296.856..63,494.823 rows=1 loops=1)

3. 1,574.773 53,220.272 ↓ 10.7 2,647,632 1

Nested Loop (cost=1.42..1,943,072.16 rows=248,555 width=68) (actual time=182.594..53,220.272 rows=2,647,632 loops=1)

4. 1,013.756 22,521.536 ↓ 7.3 2,647,633 1

Nested Loop (cost=0.86..1,532,754.96 rows=360,660 width=64) (actual time=182.566..22,521.536 rows=2,647,633 loops=1)

5. 10,587.824 10,587.824 ↑ 1.0 2,729,989 1

Index Scan using card_expirations_pkey on card_expirations (cost=0.43..244,900.61 rows=2,802,179 width=64) (actual time=182.539..10,587.824 rows=2,729,989 loops=1)

  • Filter: ((deleted_at IS NULL) AND (expired_at IS NULL) AND (should_expire_at <= now()))
  • Rows Removed by Filter: 4,076,048
6. 10,919.956 10,919.956 ↑ 1.0 1 2,729,989

Index Scan using repos_pkey on repos (cost=0.42..0.46 rows=1 width=4) (actual time=0.004..0.004 rows=1 loops=2,729,989)

  • Index Cond: (id = card_expirations.repo_id)
  • Filter: ((deleted_at IS NULL) AND (expiration_time > 0))
  • Rows Removed by Filter: 0
7. 29,123.963 29,123.963 ↑ 1.0 1 2,647,633

Index Scan using cards_pkey on cards (cost=0.56..1.14 rows=1 width=8) (actual time=0.011..0.011 rows=1 loops=2,647,633)

  • Index Cond: (id = card_expirations.card_id)
  • Filter: ((deleted_at IS NULL) AND (started_at IS NOT NULL))
  • Rows Removed by Filter: 0
8. 7,942.896 7,942.896 ↓ 0.0 0 2,647,632

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=2,647,632)

  • 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 : 3.156 ms
Execution time : 63,495.423 ms