explain.depesz.com

PostgreSQL's explain analyze made readable

Result: yaIJ : Optimization for: plan #ac6y

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 2,831.249 4,580.363 ↓ 1.0 881,342 1

Index Scan using orders_created_at1 on orders o (cost=0.44..8,976,200.88 rows=871,391 width=84) (actual time=0.057..4,580.363 rows=881,342 loops=1)

  • Index Cond: (created_at > '2020-05-01 00:00:00+00'::timestamp with time zone)
2.          

SubPlan (for Index Scan)

3. 0.000 0.000 ↓ 0.0 0 881,342

Index Scan using regions_name_key on regions r (cost=0.14..2.36 rows=1 width=0) (actual time=0.000..0.000 rows=0 loops=881,342)

  • Index Cond: (name = o.region)
  • Filter: (trash_at < o.created_at)
  • Rows Removed by Filter: 0
4. 874.557 1,749.114 ↓ 0.0 0 874,557

Nested Loop (cost=0.84..7.52 rows=1 width=0) (actual time=0.002..0.002 rows=0 loops=874,557)

  • Join Filter: (c.district_id = d.id)
5. 108.801 874.557 ↓ 0.0 0 874,557

Nested Loop (cost=0.56..5.01 rows=1 width=8) (actual time=0.001..0.001 rows=0 loops=874,557)

6. 0.000 0.000 ↓ 0.0 0 874,557

Index Scan using regions_name_key on regions r_1 (cost=0.14..2.36 rows=1 width=8) (actual time=0.000..0.000 rows=0 loops=874,557)

  • Index Cond: (name = o.region)
7. 765.756 765.756 ↓ 0.0 0 127,626

Index Scan using delivery_cities_unique_name_region_id_district_id on delivery_cities c (cost=0.42..2.64 rows=1 width=16) (actual time=0.006..0.006 rows=0 loops=127,626)

  • Index Cond: ((name = o.city) AND (region_id = r_1.id))
  • Filter: (trash_at < o.created_at)
  • Rows Removed by Filter: 1
8. 0.000 0.000 ↓ 0.0 0

Index Scan using districts_name_key on districts d (cost=0.28..2.50 rows=1 width=8) (never executed)

  • Index Cond: (name = o.district)