explain.depesz.com

PostgreSQL's explain analyze made readable

Result: oh0g

Settings
# exclusive inclusive rows x rows loops node
1. 0.051 163.428 ↓ 31.2 500 1

Limit (cost=36,592.61..36,592.65 rows=16 width=523) (actual time=163.318..163.428 rows=500 loops=1)

2. 0.909 163.377 ↓ 31.2 500 1

Sort (cost=36,592.61..36,592.65 rows=16 width=523) (actual time=163.317..163.377 rows=500 loops=1)

  • Sort Key: orders_for_algorithm.id DESC
  • Sort Method: top-N heapsort Memory: 293kB
3. 1.084 162.468 ↓ 73.0 1,168 1

Subquery Scan on orders_for_algorithm (cost=36,578.90..36,592.29 rows=16 width=523) (actual time=160.438..162.468 rows=1,168 loops=1)

  • Filter: (orders_for_algorithm.trimmed_geohash = ANY ('{6gyc,6gyf,6gy9,6gyd,6gyu}'::text[]))
  • Rows Removed by Filter: 848
4. 0.384 161.384 ↓ 3.2 2,016 1

Unique (cost=36,578.90..36,582.05 rows=630 width=523) (actual time=160.429..161.384 rows=2,016 loops=1)

5. 5.048 161.000 ↓ 3.2 2,026 1

Sort (cost=36,578.90..36,580.48 rows=630 width=523) (actual time=160.429..161.000 rows=2,026 loops=1)

  • Sort Key: orders.id
  • Sort Method: quicksort Memory: 1139kB
6. 18.818 155.952 ↓ 3.2 2,026 1

Nested Loop Left Join (cost=4.25..36,549.61 rows=630 width=523) (actual time=0.750..155.952 rows=2,026 loops=1)

7. 0.714 124.978 ↓ 3.2 2,026 1

Nested Loop Left Join (cost=3.81..32,924.48 rows=630 width=337) (actual time=0.082..124.978 rows=2,026 loops=1)

8. 1.076 118.186 ↓ 3.2 2,026 1

Nested Loop Left Join (cost=3.38..32,469.74 rows=630 width=333) (actual time=0.075..118.186 rows=2,026 loops=1)

9. 2.297 111.032 ↓ 3.2 2,026 1

Nested Loop Left Join (cost=2.81..31,734.38 rows=630 width=332) (actual time=0.070..111.032 rows=2,026 loops=1)

10. 2.136 102.657 ↓ 3.2 2,026 1

Nested Loop (cost=2.25..30,840.27 rows=630 width=307) (actual time=0.064..102.657 rows=2,026 loops=1)

  • Join Filter: (orders.id = order_addresses.order_id)
11. 0.442 94.473 ↓ 3.2 2,016 1

Nested Loop (cost=1.69..30,135.49 rows=630 width=251) (actual time=0.055..94.473 rows=2,016 loops=1)

12. 1.035 85.967 ↓ 3.2 2,016 1

Nested Loop (cost=1.12..29,318.70 rows=632 width=216) (actual time=0.049..85.967 rows=2,016 loops=1)

13. 55.643 55.643 ↑ 4.5 2,253 1

Index Scan using orders_is_active_index_dba on orders calculated (cost=0.56..1,109.80 rows=10,119 width=132) (actual time=0.036..55.643 rows=2,253 loops=1)

  • Index Cond: (is_active = true)
  • Filter: ((NOT need_be_analyzed) AND is_active AND ((storekeeper_type)::text = 'rappitendero'::text) AND ((store_type_store IS NULL) OR ((store_type_store)::text <> ALL ('{rappi_pay,rentbrella,rappi_go,go_taxi,grin}'::text[]))))
  • Rows Removed by Filter: 15383
14. 29.289 29.289 ↑ 1.0 1 2,253

Index Scan using orders_pkey on orders (cost=0.56..2.78 rows=1 width=84) (actual time=0.005..0.013 rows=1 loops=2,253)

  • Index Cond: (id = calculated.order_id)
  • Filter: ((place_at >= (now() - '15 days'::interval)) OR (created_at >= (now() - '15 days'::interval)))
  • Rows Removed by Filter: 0
15. 8.064 8.064 ↑ 1.0 1 2,016

Index Scan using order_application_users_order_id_index on order_application_users (cost=0.56..1.28 rows=1 width=35) (actual time=0.004..0.004 rows=1 loops=2,016)

  • Index Cond: (order_id = orders.id)
16. 6.048 6.048 ↑ 1.0 1 2,016

Index Scan using order_addresses_order_id_index on order_addresses (cost=0.56..1.11 rows=1 width=76) (actual time=0.003..0.003 rows=1 loops=2,016)

  • Index Cond: (order_id = order_application_users.order_id)
17. 6.078 6.078 ↑ 1.0 1 2,026

Index Scan using order_stores_order_id_index on order_stores (cost=0.56..1.41 rows=1 width=29) (actual time=0.003..0.003 rows=1 loops=2,026)

  • Index Cond: (order_id = orders.id)
18. 6.078 6.078 ↑ 1.0 1 2,026

Index Scan using order_store_zones_pkey on order_store_zones (cost=0.56..1.16 rows=1 width=5) (actual time=0.003..0.003 rows=1 loops=2,026)

  • Index Cond: (order_id = orders.id)
19. 6.078 6.078 ↑ 1.0 1 2,026

Index Only Scan using order_partner_order_id_unique on order_partner (cost=0.43..0.71 rows=1 width=4) (actual time=0.003..0.003 rows=1 loops=2,026)

  • Index Cond: (order_id = orders.id)
  • Heap Fetches: 1517
20. 6.078 6.078 ↑ 1.0 1 2,026

Index Scan using delivery_order_order_id_unique on delivery_order (cost=0.44..0.99 rows=1 width=13) (actual time=0.003..0.003 rows=1 loops=2,026)

  • Index Cond: (order_id = orders.id)
21.          

SubPlan (for Nested Loop Left Join)

22. 2.026 6.078 ↓ 0.0 0 2,026

GroupAggregate (cost=0.43..4.70 rows=4 width=36) (actual time=0.003..0.003 rows=0 loops=2,026)

  • Group Key: dso.order_id
23. 4.052 4.052 ↓ 0.0 0 2,026

Index Scan using discarded_orders_order_id_index on discarded_orders dso (cost=0.43..4.63 rows=4 width=8) (actual time=0.002..0.002 rows=0 loops=2,026)

  • Index Cond: (order_id = orders.id)