explain.depesz.com

PostgreSQL's explain analyze made readable

Result: VvLp

Settings
# exclusive inclusive rows x rows loops node
1. 32.521 119.541 ↑ 1.4 10,780 1

Sort (cost=40,533.96..40,571.18 rows=14,891 width=1,608) (actual time=114.128..119.541 rows=10,780 loops=1)

  • Sort Key: ((45 - sum((bookings_1.total_night + 1))))
  • Sort Method: external merge Disk: 16896kB
2. 13.588 87.020 ↑ 1.4 10,780 1

Hash Join (cost=23,760.49..29,117.35 rows=14,891 width=1,608) (actual time=67.594..87.020 rows=10,780 loops=1)

  • Hash Cond: (bookings.rv_id = rvs.id)
3. 5.847 66.216 ↑ 1.5 11,014 1

Hash Right Join (cost=21,791.88..24,398.66 rows=16,844 width=345) (actual time=60.300..66.216 rows=11,014 loops=1)

  • Hash Cond: (rvs_1.id = bookings.rv_id)
4. 0.599 28.818 ↑ 5.0 709 1

HashAggregate (cost=10,869.29..10,913.31 rows=3,521 width=8) (actual time=28.704..28.818 rows=709 loops=1)

  • Group Key: rvs_1.id
5. 0.764 28.219 ↑ 2.2 1,920 1

Hash Join (cost=943.98..10,837.08 rows=4,295 width=8) (actual time=4.434..28.219 rows=1,920 loops=1)

  • Hash Cond: (bookings_1.rv_id = rvs_1.id)
6. 23.059 23.059 ↑ 1.8 4,810 1

Seq Scan on bookings bookings_1 (cost=0.00..9,817.60 rows=8,682 width=8) (actual time=0.016..23.059 rows=4,810 loops=1)

  • Filter: ((status = ANY ('{4,5}'::integer[])) AND (((start_date >= '2019-06-30 00:00:00'::timestamp without time zone) AND (start_date <= '2020-06-30 00:00:00'::timestamp without time zone)) OR ((end_date >= '2019-06-30 00:00:00'::timestamp without time zone) AND (end_date <= '2020-06-30 00:00:00'::timestamp without time zone)) OR ((start_date < '2019-06-30 00:00:00'::timestamp without time zone) AND (end_date > '2020-06-30 00:00:00'::timestamp without time zone))))
  • Rows Removed by Filter: 117941
7. 0.417 4.396 ↓ 1.0 3,522 1

Hash (cost=899.96..899.96 rows=3,521 width=4) (actual time=4.396..4.396 rows=3,522 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 156kB
8. 3.979 3.979 ↓ 1.0 3,522 1

Seq Scan on rvs rvs_1 (cost=0.00..899.96 rows=3,521 width=4) (actual time=0.012..3.979 rows=3,522 loops=1)

  • Filter: (camplify_insurance = 2)
  • Rows Removed by Filter: 3595
9. 3.181 31.551 ↑ 1.5 11,014 1

Hash (cost=9,971.03..9,971.03 rows=16,844 width=333) (actual time=31.551..31.551 rows=11,014 loops=1)

  • Buckets: 16384 Batches: 2 Memory Usage: 1470kB
10. 28.370 28.370 ↑ 1.5 11,014 1

Seq Scan on bookings (cost=0.00..9,971.03 rows=16,844 width=333) (actual time=0.017..28.370 rows=11,014 loops=1)

  • Filter: ((status = ANY ('{2,4,5}'::integer[])) AND (((start_date >= '2018-09-05 00:00:00'::timestamp without time zone) AND (start_date <= '2019-09-05 00:00:00'::timestamp without time zone)) OR ((end_date >= '2018-09-05 00:00:00'::timestamp without time zone) AND (end_date <= '2019-09-05 00:00:00'::timestamp without time zone)) OR ((start_date < '2018-09-05 00:00:00'::timestamp without time zone) AND (end_date > '2019-09-05 00:00:00'::timestamp without time zone))))
  • Rows Removed by Filter: 111737
11. 3.025 7.216 ↑ 1.2 5,207 1

Hash (cost=899.96..899.96 rows=6,292 width=1,263) (actual time=7.216..7.216 rows=5,207 loops=1)

  • Buckets: 4096 Batches: 2 Memory Usage: 2744kB
12. 4.191 4.191 ↑ 1.2 5,207 1

Seq Scan on rvs (cost=0.00..899.96 rows=6,292 width=1,263) (actual time=0.016..4.191 rows=5,207 loops=1)

  • Filter: ((camplify_insurance <> ALL ('{0,1}'::integer[])) OR (insurance_product_id IS NOT NULL))
  • Rows Removed by Filter: 1910
Planning time : 1.413 ms
Execution time : 127.875 ms