explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 4VcZ : Optimization for: plan #ac6y

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 1,994.405 17,035.637 ↑ 1.0 201,472 1

Seq Scan on orders o (cost=0.00..4,848,431.80 rows=201,472 width=80) (actual time=0.152..17,035.637 rows=201,472 loops=1)

2.          

SubPlan (for Seq Scan)

3. 6,245.632 6,245.632 ↓ 0.0 0 201,472

Seq Scan on regions r (cost=0.00..3.74 rows=1 width=0) (actual time=0.031..0.031 rows=0 loops=201,472)

  • Filter: ((trash_at < o.created_at) AND (name = o.region))
  • Rows Removed by Filter: 115
4. 199.785 8,795.600 ↓ 0.0 0 199,900

Nested Loop (cost=0.70..20.21 rows=1 width=0) (actual time=0.044..0.044 rows=0 loops=199,900)

  • Join Filter: (c.district_id = d.id)
5. 604.415 8,595.700 ↓ 0.0 0 199,900

Nested Loop (cost=0.42..11.90 rows=1 width=8) (actual time=0.043..0.043 rows=0 loops=199,900)

6. 6,996.500 6,996.500 ↓ 0.0 0 199,900

Seq Scan on regions r_1 (cost=0.00..3.45 rows=1 width=8) (actual time=0.032..0.035 rows=0 loops=199,900)

  • Filter: (name = o.region)
  • Rows Removed by Filter: 116
7. 994.785 994.785 ↓ 0.0 0 30,145

Index Scan using delivery_cities_unique_name_region_id_district_id on delivery_cities c (cost=0.42..8.44 rows=1 width=16) (actual time=0.033..0.033 rows=0 loops=30,145)

  • Index Cond: ((name = o.city) AND (region_id = r_1.id))
  • Filter: (trash_at < o.created_at)
  • Rows Removed by Filter: 1
8. 0.115 0.115 ↑ 1.0 1 5

Index Scan using districts_name_key on districts d (cost=0.28..8.30 rows=1 width=8) (actual time=0.023..0.023 rows=1 loops=5)

  • Index Cond: (name = o.district)
Planning time : 1.021 ms
Execution time : 17,075.989 ms