explain.depesz.com

PostgreSQL's explain analyze made readable

Result: K7UT

Settings
# exclusive inclusive rows x rows loops node
1. 4.274 16,687.636 ↑ 1.0 1 1

Aggregate (cost=5,280.64..5,280.74 rows=1 width=16) (actual time=16,687.635..16,687.636 rows=1 loops=1)

2.          

Initplan (forAggregate)

3. 0.539 680.755 ↑ 1.0 1 1

Aggregate (cost=4,722.56..4,722.66 rows=1 width=8) (actual time=680.754..680.755 rows=1 loops=1)

4. 680.216 680.216 ↓ 22.2 489 1

Index Scan using search_platform_merchants_suptak_supdel_index on merchants m (cost=0.55..4,722.51 rows=22 width=0) (actual time=7.408..680.216 rows=489 loops=1)

  • Index Cond: (supports_takeout = true)
  • Filter: (supports_takeout AND (channels && '{IFOOD}'::text[]) AND ((location)::geography && '0101000020E6100000DB4FC6F8305747C056B60F79CB9537C0'::geography) AND ('0101000020E6100000DB4FC6F8305747C056B60F79CB9537C0'::geography && _st_expand((location)::geography, '30000'::double precision)) AND _st_dwithin((location)::geography, '0101000020E6100000DB4FC6F8305747C056B60F79CB9537C0'::geography, '30000'::double precision, true))
  • Rows Removed by Filter: 1219
5. 12.064 16,002.607 ↓ 53.9 4,366 1

Nested Loop (cost=164.10..557.78 rows=81 width=0) (actual time=12,519.865..16,002.607 rows=4,366 loops=1)

6. 7.779 12,530.703 ↓ 63.6 5,406 1

Unique (cost=163.68..164.11 rows=85 width=28) (actual time=12,518.076..12,530.703 rows=5,406 loops=1)

7. 18.760 12,522.924 ↓ 64.0 5,443 1

Sort (cost=163.68..163.89 rows=85 width=28) (actual time=12,518.073..12,522.924 rows=5,443 loops=1)

  • Sort Key: "*SELECT* 1".owner_id, (("*SELECT* 1".mode <> 'EXCLUSION'::delivery_mode)), "*SELECT* 1".zipcode COLLATE "C", "*SELECT* 1".priority
  • Sort Method: quicksort Memory: 618kB
8. 7.405 12,504.164 ↓ 64.0 5,443 1

Result (cost=0.85..160.96 rows=85 width=28) (actual time=14.846..12,504.164 rows=5,443 loops=1)

9. 5.668 12,496.759 ↓ 64.0 5,443 1

Append (cost=0.85..152.25 rows=85 width=31) (actual time=14.844..12,496.759 rows=5,443 loops=1)

10. 7.138 12,486.008 ↓ 90.3 5,421 1

Subquery Scan on *SELECT* 1 (cost=0.85..94.99 rows=60 width=31) (actual time=14.843..12,486.008 rows=5,421 loops=1)

11. 23.431 12,478.870 ↓ 90.3 5,421 1

Nested Loop (cost=0.85..88.99 rows=60 width=159) (actual time=14.841..12,478.870 rows=5,421 loops=1)

12. 7,445.985 7,445.985 ↓ 5,251.0 5,251 1

Index Scan using polygons_geom_idx on polygons pol (cost=0.42..4.78 rows=1 width=16) (actual time=8.780..7,445.985 rows=5,251 loops=1)

  • Index Cond: (geom && '0101000020E6100000DB4FC6F8305747C056B60F79CB9537C0'::geometry)
  • Filter: _st_intersects(geom, '0101000020E6100000DB4FC6F8305747C056B60F79CB9537C0'::geometry)
  • Rows Removed by Filter: 10370
13. 5,009.454 5,009.454 ↑ 60.0 1 5,251

Index Scan using deliveries_pol_id_idx on deliveries dels (cost=0.43..78.22 rows=60 width=47) (actual time=0.919..0.954 rows=1 loops=5,251)

  • Index Cond: (pol_id = pol.pol_id)
14. 0.021 5.083 ↑ 1.1 22 1

Subquery Scan on *SELECT* 2 (cost=0.43..57.25 rows=25 width=31) (actual time=2.032..5.083 rows=22 loops=1)

15. 5.062 5.062 ↑ 1.1 22 1

Index Scan using deliveries_zipcode_idx on deliveries dels_1 (cost=0.43..54.75 rows=25 width=159) (actual time=2.029..5.062 rows=22 loops=1)

  • Index Cond: (zipcode = '04538110'::text)
16. 3,459.840 3,459.840 ↑ 1.0 1 5,406

Index Scan using merchants_pkey on merchants merc (cost=0.42..4.53 rows=1 width=16) (actual time=0.640..0.640 rows=1 loops=5,406)

  • Index Cond: (merchant_id = "*SELECT* 1".owner_id)
  • Filter: (supports_delivery AND (channels && '{IFOOD}'::text[]))
  • Rows Removed by Filter: 0
Planning time : 63.669 ms
Execution time : 16,687.935 ms