explain.depesz.com

PostgreSQL's explain analyze made readable

Result: pze

Settings
# exclusive inclusive rows x rows loops node
1. 1.973 15.393 ↑ 1.0 2,661 1

Hash Right Join (cost=547.46..1,254.25 rows=2,675 width=4,991) (actual time=7.207..15.393 rows=2,661 loops=1)

  • Hash Cond: (t3.provider_id = p0.id)
2. 6.257 6.257 ↓ 1.0 7,688 1

Seq Scan on time_blocks t3 (cost=0.00..651.30 rows=7,664 width=595) (actual time=0.014..6.257 rows=7,688 loops=1)

  • Filter: ('["2019-06-07 06:00:00-07","2019-06-14 05:00:00-07")'::tstzrange && time_range)
  • Rows Removed by Filter: 16176
3. 0.069 7.163 ↑ 1.0 142 1

Hash (cost=545.61..545.61 rows=148 width=4,396) (actual time=7.163..7.163 rows=142 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 34kB
4. 0.038 7.094 ↑ 1.0 142 1

Nested Loop (cost=460.42..545.61 rows=148 width=4,396) (actual time=6.570..7.094 rows=142 loops=1)

5. 0.007 6.726 ↑ 1.0 10 1

Nested Loop Left Join (cost=460.13..483.73 rows=10 width=4,412) (actual time=6.552..6.726 rows=10 loops=1)

6. 0.053 6.709 ↑ 1.0 10 1

Hash Join (cost=460.00..480.93 rows=10 width=2,232) (actual time=6.545..6.709 rows=10 loops=1)

  • Hash Cond: (p0.id = s1.id)
7. 0.127 0.127 ↑ 1.0 424 1

Seq Scan on providers p0 (cost=0.00..19.24 rows=424 width=2,216) (actual time=0.011..0.127 rows=424 loops=1)

8. 0.005 6.529 ↑ 1.0 10 1

Hash (cost=459.87..459.87 rows=10 width=16) (actual time=6.529..6.529 rows=10 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
9. 0.003 6.524 ↑ 1.0 10 1

Subquery Scan on s1 (cost=459.75..459.87 rows=10 width=16) (actual time=6.518..6.524 rows=10 loops=1)

10. 0.003 6.521 ↑ 1.0 10 1

Limit (cost=459.75..459.77 rows=10 width=6,240) (actual time=6.518..6.521 rows=10 loops=1)

11. 0.155 6.518 ↑ 42.4 10 1

Sort (cost=459.75..460.81 rows=424 width=6,240) (actual time=6.517..6.518 rows=10 loops=1)

  • Sort Key: p0_1.last_booked_at NULLS FIRST
  • Sort Method: top-N heapsort Memory: 25kB
12. 0.267 6.363 ↑ 1.0 424 1

Nested Loop Semi Join (cost=0.29..450.58 rows=424 width=6,240) (actual time=0.028..6.363 rows=424 loops=1)

13. 0.160 0.160 ↑ 1.0 424 1

Seq Scan on providers p0_1 (cost=0.00..19.24 rows=424 width=24) (actual time=0.003..0.160 rows=424 loops=1)

14. 5.936 5.936 ↑ 15.0 1 424

Index Scan using time_blocks_provider_id_index on time_blocks (cost=0.29..5.90 rows=15 width=16) (actual time=0.014..0.014 rows=1 loops=424)

  • Index Cond: (provider_id = p0_1.id)
  • Filter: (available AND (time_range && '["2019-06-07 06:00:00-07","2019-06-14 05:00:00-07")'::tstzrange))
  • Rows Removed by Filter: 17
15. 0.010 0.010 ↓ 0.0 0 10

Index Scan using appointments_receiving_provider_id_index on appointments a4 (cost=0.14..0.27 rows=1 width=2,180) (actual time=0.001..0.001 rows=0 loops=10)

  • Index Cond: (receiving_provider_id = p0.id)
  • Filter: ((NOT cancelled) AND ('["2019-06-07 06:00:00-07","2019-06-14 05:00:00-07")'::tstzrange && time_range))
16. 0.330 0.330 ↑ 1.1 14 10

Index Scan using time_blocks_provider_id_index on time_blocks t2 (cost=0.29..6.04 rows=15 width=16) (actual time=0.011..0.033 rows=14 loops=10)

  • Index Cond: (provider_id = p0.id)
  • Filter: (available AND ((reserved_for_external_system IS NULL) OR ((reserved_for_external_system)::text = 'Isaac'::text)) AND ('["2019-06-07 06:00:00-07","2019-06-14 05:00:00-07")'::tstzrange && time_range))
  • Rows Removed by Filter: 44
Planning time : 1.221 ms