explain.depesz.com

PostgreSQL's explain analyze made readable

Result: mTBk

Settings
# exclusive inclusive rows x rows loops node
1. 3.039 714.739 ↓ 1.3 753 1

Sort (cost=347,280.91..347,282.36 rows=580 width=15,297) (actual time=714.580..714.739 rows=753 loops=1)

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

CTE app

3. 131.495 141.580 ↓ 1.0 115,926 1

Bitmap Heap Scan on appointments (cost=2,666.08..30,752.92 rows=111,189 width=1,955) (actual time=11.407..141.580 rows=115,926 loops=1)

  • Recheck Cond: ((invoice_generation_time >= 1546300800) AND (invoice_generation_time <= 1567727999))
  • Filter: invoice_generated
  • Heap Blocks: exact=9650
4. 10.085 10.085 ↓ 1.0 115,926 1

Bitmap Index Scan on idx_invoice_details (cost=0.00..2,638.29 rows=111,189 width=0) (actual time=10.085..10.085 rows=115,926 loops=1)

  • Index Cond: ((invoice_generated = true) AND (invoice_generation_time >= 1546300800) AND (invoice_generation_time <= 1567727999))
5. 1.591 711.700 ↓ 1.3 753 1

Nested Loop (cost=5,589.28..312,700.37 rows=580 width=15,297) (actual time=232.304..711.700 rows=753 loops=1)

6. 164.810 708.601 ↓ 1.3 754 1

Hash Join (cost=5,588.85..312,370.57 rows=598 width=14,394) (actual time=232.278..708.601 rows=754 loops=1)

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

CTE Scan on app (cost=0.00..2,223.78 rows=111,189 width=11,153) (actual time=11.414..455.994 rows=115,926 loops=1)

8. 44.296 87.797 ↓ 14.7 19,650 1

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

  • Buckets: 2048 (originally 2048) Batches: 8 (originally 2) Memory Usage: 4081kB
9. 18.462 43.501 ↓ 14.7 19,650 1

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

10. 0.004 0.005 ↑ 1.0 1 1

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

  • Group Key: 1153
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.034 25.034 ↓ 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.013..25.034 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 : 4.008 ms
Execution time : 723.931 ms