explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Zz3X

Settings
# exclusive inclusive rows x rows loops node
1. 110.350 1,500.315 ↑ 6.7 22 1

Unique (cost=1,001,463.43..1,006,651.59 rows=148 width=21) (actual time=1,298.324..1,500.315 rows=22 loops=1)

2. 426.677 1,389.965 ↓ 1.5 1,528,206 1

Sort (cost=1,001,463.43..1,004,057.51 rows=1,037,632 width=21) (actual time=1,298.323..1,389.965 rows=1,528,206 loops=1)

  • Sort Key: datasource_productline.name
  • Sort Method: quicksort Memory: 120287kB
3. 290.498 963.288 ↓ 1.5 1,528,206 1

Hash Join (cost=830,762.88..897,778.76 rows=1,037,632 width=21) (actual time=139.790..963.288 rows=1,528,206 loops=1)

  • Hash Cond: (inspections_bookingitem.product_category_id = datasource_productcategory.id)
4. 272.543 656.471 ↓ 1.5 1,528,206 1

Hash Join (cost=829,048.64..881,797.07 rows=1,037,632 width=4) (actual time=123.358..656.471 rows=1,528,206 loops=1)

  • Hash Cond: (inspections_bookingitem.booking_id = inspections_booking.id)
5. 260.960 260.960 ↓ 1.0 1,670,847 1

Seq Scan on inspections_bookingitem (cost=0.00..36,212.54 rows=1,642,554 width=8) (actual time=0.113..260.960 rows=1,670,847 loops=1)

  • Filter: (booking_id IS NOT NULL)
6. 12.487 122.968 ↓ 1.2 76,507 1

Hash (cost=828,281.61..828,281.61 rows=61,362 width=4) (actual time=122.968..122.968 rows=76,507 loops=1)

  • Buckets: 131072 (originally 65536) Batches: 1 (originally 1) Memory Usage: 3714kB
7. 71.433 110.481 ↓ 1.2 76,507 1

Seq Scan on inspections_booking (cost=0.00..828,281.61 rows=61,362 width=4) (actual time=0.090..110.481 rows=76,507 loops=1)

  • Filter: (((status)::text = ANY ('{upcoming,new,waived,confirmed,rejected,merged}'::text[])) AND ((book_to_org_id = 252437) OR (executor_id = 252437) OR (book_from_org_id = 252437) OR (alternatives: SubPlan 1 or hashed SubPlan 2)))
  • Rows Removed by Filter: 19782
8.          

SubPlan (forSeq Scan)

9. 0.000 0.000 ↓ 0.0 0

Index Scan using inspections_customorgcontactlocation_pkey on inspections_customorgcontactlocation (cost=0.42..8.44 rows=1 width=0) (never executed)

  • Index Cond: (inspections_booking.retailer_information_id = id)
  • Filter: (org_id = 252437)
10. 31.502 39.048 ↑ 1.1 125,284 1

Bitmap Heap Scan on inspections_customorgcontactlocation inspections_customorgcontactlocation_1 (cost=2,888.07..14,458.02 rows=133,116 width=4) (actual time=8.865..39.048 rows=125,284 loops=1)

  • Recheck Cond: (org_id = 252437)
  • Heap Blocks: exact=9489
11. 7.546 7.546 ↑ 1.1 125,630 1

Bitmap Index Scan on inspections_customorgcontactlocation_org_id_d1e2d4e4 (cost=0.00..2,854.79 rows=133,116 width=0) (actual time=7.546..7.546 rows=125,630 loops=1)

  • Index Cond: (org_id = 252437)
12. 5.528 16.319 ↓ 1.0 32,644 1

Hash (cost=1,306.83..1,306.83 rows=32,593 width=25) (actual time=16.319..16.319 rows=32,644 loops=1)

  • Buckets: 32768 Batches: 1 Memory Usage: 2056kB
13. 8.179 10.791 ↓ 1.0 32,644 1

Hash Join (cost=40.75..1,306.83 rows=32,593 width=25) (actual time=0.446..10.791 rows=32,644 loops=1)

  • Hash Cond: (datasource_productcategory.product_line_id = datasource_productline.id)
14. 2.266 2.266 ↓ 1.0 32,644 1

Seq Scan on datasource_productcategory (cost=0.00..817.93 rows=32,593 width=8) (actual time=0.093..2.266 rows=32,644 loops=1)

15. 0.197 0.346 ↓ 1.0 1,036 1

Hash (cost=28.11..28.11 rows=1,011 width=25) (actual time=0.346..0.346 rows=1,036 loops=1)

  • Buckets: 2048 (originally 1024) Batches: 1 (originally 1) Memory Usage: 76kB
16. 0.149 0.149 ↓ 1.0 1,036 1

Seq Scan on datasource_productline (cost=0.00..28.11 rows=1,011 width=25) (actual time=0.016..0.149 rows=1,036 loops=1)

Planning time : 0.638 ms