explain.depesz.com

PostgreSQL's explain analyze made readable

Result: qx8p

Settings
# exclusive inclusive rows x rows loops node
1. 5.692 72.433 ↓ 1.3 9,117 1

Sort (cost=22,663.20..22,680.94 rows=7,095 width=341) (actual time=71.850..72.433 rows=9,117 loops=1)

  • Sort Key: ((45 - sum((bookings_1.total_night + 1))))
  • Sort Method: quicksort Memory: 3173kB
2. 4.009 66.741 ↓ 1.3 9,117 1

Hash Right Join (cost=21,386.11..22,209.39 rows=7,095 width=341) (actual time=62.664..66.741 rows=9,117 loops=1)

  • Hash Cond: (rvs_1.id = bookings.rv_id)
3. 0.618 27.507 ↑ 5.0 709 1

HashAggregate (cost=10,254.82..10,298.83 rows=3,521 width=8) (actual time=27.418..27.507 rows=709 loops=1)

  • Group Key: rvs_1.id
4. 0.753 26.889 ↑ 2.2 1,920 1

Hash Join (cost=943.98..10,222.82 rows=4,266 width=8) (actual time=4.252..26.889 rows=1,920 loops=1)

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

Seq Scan on bookings bookings_1 (cost=0.00..9,203.85 rows=8,623 width=8) (actual time=0.016..21.911 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))))
  • Rows Removed by Filter: 117941
6. 0.405 4.225 ↓ 1.0 3,522 1

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

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

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

  • Filter: (camplify_insurance = 2)
  • Rows Removed by Filter: 3595
8. 5.345 35.225 ↓ 1.3 9,117 1

Hash (cost=11,042.60..11,042.60 rows=7,095 width=333) (actual time=35.225..35.225 rows=9,117 loops=1)

  • Buckets: 16384 (originally 8192) Batches: 1 (originally 1) Memory Usage: 2400kB
9. 4.184 29.880 ↓ 1.3 9,117 1

Hash Join (cost=937.40..11,042.60 rows=7,095 width=333) (actual time=3.812..29.880 rows=9,117 loops=1)

  • Hash Cond: (bookings.rv_id = rvs.id)
10. 21.907 21.907 ↑ 1.5 11,027 1

Seq Scan on bookings (cost=0.00..9,971.03 rows=16,859 width=333) (actual time=0.010..21.907 rows=11,027 loops=1)

  • Filter: ((status = ANY ('{2,4,5}'::integer[])) AND (((start_date >= '2018-09-04 14:00:00'::timestamp without time zone) AND (start_date <= '2019-09-05 13:59:59.999999'::timestamp without time zone)) OR ((end_date >= '2018-09-04 14:00:00'::timestamp without time zone) AND (end_date <= '2019-09-05 13:59:59.999999'::timestamp without time zone)) OR ((start_date < '2018-09-04 14:00:00'::timestamp without time zone) AND (end_date > '2019-09-05 13:59:59.999999'::timestamp without time zone))))
  • Rows Removed by Filter: 111724
11. 0.408 3.789 ↓ 1.4 4,082 1

Hash (cost=899.96..899.96 rows=2,995 width=4) (actual time=3.789..3.789 rows=4,082 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 176kB
12. 3.381 3.381 ↓ 1.4 4,082 1

Seq Scan on rvs (cost=0.00..899.96 rows=2,995 width=4) (actual time=0.005..3.381 rows=4,082 loops=1)

  • Filter: ((insurance_product_id IS NOT NULL) AND (camplify_insurance <> ALL ('{1,0}'::integer[])))
  • Rows Removed by Filter: 3035
Planning time : 0.455 ms
Execution time : 72.898 ms