explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 1bMW

Settings
# exclusive inclusive rows x rows loops node
1. 4.704 41,139.363 ↓ 7,620.0 7,620 1

WindowAgg (cost=30,480.25..30,480.27 rows=1 width=96) (actual time=41,134.078..41,139.363 rows=7,620 loops=1)

2. 9.686 41,134.659 ↓ 7,620.0 7,620 1

Sort (cost=30,480.25..30,480.26 rows=1 width=88) (actual time=41,133.986..41,134.659 rows=7,620 loops=1)

  • Sort Key: t.start_date
  • Sort Method: quicksort Memory: 1264kB
3. 6.963 41,124.973 ↓ 7,620.0 7,620 1

WindowAgg (cost=30,479.55..30,480.24 rows=1 width=88) (actual time=41,122.062..41,124.973 rows=7,620 loops=1)

4. 1.360 41,118.010 ↓ 7,620.0 7,620 1

Subquery Scan on t (cost=30,479.55..30,480.23 rows=1 width=80) (actual time=41,102.714..41,118.010 rows=7,620 loops=1)

  • Filter: (t.rn = 1)
5. 13.076 41,116.650 ↓ 476.2 7,620 1

WindowAgg (cost=30,479.55..30,480.03 rows=16 width=80) (actual time=41,102.711..41,116.650 rows=7,620 loops=1)

6. 17.959 41,103.574 ↓ 476.2 7,620 1

Sort (cost=30,479.55..30,479.59 rows=16 width=72) (actual time=41,102.681..41,103.574 rows=7,620 loops=1)

  • Sort Key: sh.shift_uuid, sho.start_date, sho.end_date, (lower(sh.valid_range)) DESC
  • Sort Method: quicksort Memory: 1264kB
7. 28.598 41,085.615 ↓ 476.2 7,620 1

Nested Loop (cost=0.43..30,479.23 rows=16 width=72) (actual time=153.649..41,085.615 rows=7,620 loops=1)

8. 2.872 688.687 ↓ 4.5 8,935 1

Append (cost=0.00..23,850.09 rows=1,968 width=64) (actual time=21.086..688.687 rows=8,935 loops=1)

9. 685.815 685.815 ↓ 4.5 8,935 1

Seq Scan on shift_occurrence_org_part_11 sho (cost=0.00..23,840.25 rows=1,968 width=64) (actual time=21.084..685.815 rows=8,935 loops=1)

  • Filter: ((start_date < end_date) AND (organization_uuid = '9179fd37-1322-4957-8a99-7e2056388b4f'::uuid) AND (tstzrange((start_date)::timestamp with time zone, (end_date)::timestamp with time zone, '[)'::text) && '["2019-09-13 00:00:00+00","2019-09-14 00:00:00+00")'::tstzrange))
  • Rows Removed by Filter: 581395
10. 40,368.330 40,368.330 ↑ 1.0 1 8,935

Index Scan using shifts_revision_uuid_pk on shifts sh (cost=0.43..3.37 rows=1 width=68) (actual time=4.518..4.518 rows=1 loops=8,935)

  • Index Cond: (revision_uuid = sho.shift_revision_uuid)
  • Filter: (organization_uuid = '9179fd37-1322-4957-8a99-7e2056388b4f'::uuid)