explain.depesz.com

PostgreSQL's explain analyze made readable

Result: V4QX

Settings
# exclusive inclusive rows x rows loops node
1. 3.000 617.637 ↓ 1.3 753 1

Sort (cost=347,433.48..347,434.93 rows=580 width=15,297) (actual time=617.482..617.637 rows=753 loops=1)

  • Sort Key: rs.appt_id, receipts.ride_detail_id
  • Sort Method: quicksort Memory: 1,574kB
2.          

CTE app

3. 119.616 143.351 ↓ 1.0 115,926 1

Bitmap Heap Scan on appointments (cost=2,575.20..30,810.65 rows=111,224 width=1,955) (actual time=25.077..143.351 rows=115,926 loops=1)

  • Recheck Cond: ((invoice_generation_time >= 1,546,300,800) AND (invoice_generation_time <= 1,567,727,999))
  • Filter: invoice_generated
  • Rows Removed by Filter: 5,343
  • Heap Blocks: exact=9,703
4. 23.735 23.735 ↓ 1.0 121,269 1

Bitmap Index Scan on invoice_generation_time_appt_idx (cost=0.00..2,547.39 rows=121,097 width=0) (actual time=23.735..23.735 rows=121,269 loops=1)

  • Index Cond: ((invoice_generation_time >= 1,546,300,800) AND (invoice_generation_time <= 1,567,727,999))
5. 1.569 614.637 ↓ 1.3 753 1

Nested Loop (cost=5,589.28..312,795.20 rows=580 width=15,297) (actual time=145.271..614.637 rows=753 loops=1)

6. 144.747 611.560 ↓ 1.3 754 1

Hash Join (cost=5,588.85..312,465.40 rows=598 width=14,394) (actual time=145.243..611.560 rows=754 loops=1)

  • Hash Cond: (app.id = rs.appt_id)
7. 380.258 380.258 ↓ 1.0 115,926 1

CTE Scan on app (cost=0.00..2,224.48 rows=111,224 width=11,153) (actual time=25.086..380.258 rows=115,926 loops=1)

8. 43.115 86.555 ↓ 14.7 19,650 1

Hash (cost=5,037.14..5,037.14 rows=1,337 width=3,241) (actual time=86.554..86.555 rows=19,650 loops=1)

  • Buckets: 2,048 (originally 2048) Batches: 8 (originally 2) Memory Usage: 4,081kB
9. 18.357 43.440 ↓ 14.7 19,650 1

Nested Loop (cost=0.45..5,037.14 rows=1,337 width=3,241) (actual time=0.027..43.440 rows=19,650 loops=1)

10. 0.005 0.006 ↑ 1.0 1 1

HashAggregate (cost=0.02..0.03 rows=1 width=4) (actual time=0.005..0.006 rows=1 loops=1)

  • Group Key: 1,153
11. 0.001 0.001 ↑ 1.0 1 1

Result (cost=0.00..0.01 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=1)

12. 25.077 25.077 ↓ 14.7 19,650 1

Index Scan using idx_ride_organisationid on ride_details rs (cost=0.42..5,023.74 rows=1,337 width=3,241) (actual time=0.015..25.077 rows=19,650 loops=1)

  • Index Cond: (org_id = (1153))
  • Filter: ((NOT is_pr_ride) AND ((ride_category)::text = 'completed'::text))
  • Rows Removed by Filter: 20
13. 1.508 1.508 ↑ 1.0 1 754

Index Scan using idx_ride_detail_id on receipts (cost=0.42..0.55 rows=1 width=895) (actual time=0.002..0.002 rows=1 loops=754)

  • Index Cond: (ride_detail_id = rs.id)
Planning time : 3.964 ms
Execution time : 626.649 ms