explain.depesz.com

PostgreSQL's explain analyze made readable

Result: xTz5

Settings
# exclusive inclusive rows x rows loops node
1. 75.870 382.516 ↑ 11.2 45,962 1

Sort (cost=740,146.05..741,431.05 rows=514,000 width=49) (actual time=364.586..382.516 rows=45,962 loops=1)

  • Sort Key: (generate_series('2018-05-11 00:00:00'::timestamp without time zone, '2018-05-17 00:00:00'::timestamp without time zone, '1 day'::interval)), l.id, al.id
  • Sort Method: quicksort Memory: 5134kB
2. 87.284 306.646 ↑ 11.2 45,962 1

Nested Loop Left Join (cost=1.92..691,389.53 rows=514,000 width=49) (actual time=0.102..306.646 rows=45,962 loops=1)

3. 40.179 81.476 ↑ 11.2 45,962 1

Nested Loop (cost=0.84..6,484.53 rows=514,000 width=40) (actual time=0.069..81.476 rows=45,962 loops=1)

4. 0.018 0.018 ↑ 142.9 7 1

Result (cost=0.00..5.01 rows=1,000 width=8) (actual time=0.009..0.018 rows=7 loops=1)

5. 25.853 41.279 ↓ 12.8 6,566 7

Materialize (cost=0.84..45.81 rows=514 width=32) (actual time=0.008..5.897 rows=6,566 loops=7)

6. 8.985 15.426 ↓ 12.8 6,566 1

Nested Loop (cost=0.84..43.24 rows=514 width=32) (actual time=0.051..15.426 rows=6,566 loops=1)

7. 0.071 0.071 ↓ 14.0 14 1

Index Scan using location_nodupspreadsheetindex on location l (cost=0.42..2.35 rows=1 width=8) (actual time=0.035..0.071 rows=14 loops=1)

  • Index Cond: (v2organization_id = 4608)
  • Filter: (id = ANY ('{61631,80493,61630,61629,80482,80488,80491,80481,80487,80490,80480,80483,80489,80478}'::integer[]))
  • Rows Removed by Filter: 5
8. 6.370 6.370 ↑ 1.1 469 14

Index Scan using acuity_level_v2organization_id_name_key on acuity_level al (cost=0.42..35.75 rows=514 width=32) (actual time=0.005..0.455 rows=469 loops=14)

  • Index Cond: (v2organization_id = 4608)
9. 44.562 137.886 ↓ 0.0 0 45,962

Limit (cost=1.09..1.31 rows=1 width=17) (actual time=0.003..0.003 rows=0 loops=45,962)

10.          

Initplan (forLimit)

11. 0.175 1.400 ↑ 1.0 1 175

Limit (cost=0.43..0.66 rows=1 width=8) (actual time=0.008..0.008 rows=1 loops=175)

12. 1.225 1.225 ↑ 1.0 1 175

Index Scan Backward using unique_acuity_location_date_lkey on location_census location_census_1 (cost=0.43..0.66 rows=1 width=8) (actual time=0.007..0.007 rows=1 loops=175)

  • Index Cond: ((location_id = $0) AND (acuity_level_id = $1) AND (observation_date < $2))
13. 91.924 91.924 ↓ 0.0 0 45,962

Index Scan Backward using unique_acuity_location_date_lkey on location_census (cost=0.43..0.66 rows=1 width=17) (actual time=0.002..0.002 rows=0 loops=45,962)

  • Index Cond: ((location_id = l.id) AND (acuity_level_id = al.id) AND (observation_date <= (generate_series('2018-05-11 00:00:00'::timestamp without time zone, '2018-05-17 00:00:00'::timestamp without time zone, '1 day'::interval))))