explain.depesz.com

PostgreSQL's explain analyze made readable

Result: MXyG

Settings
# exclusive inclusive rows x rows loops node
1. 0.002 2,965.631 ↑ 1.0 10 1

Limit (cost=247,319.10..247,320.78 rows=10 width=2,432) (actual time=2,965.617..2,965.631 rows=10 loops=1)

2. 0.013 2,965.629 ↑ 6,625.1 10 1

Unique (cost=247,319.10..258,416.14 rows=66,251 width=2,432) (actual time=2,965.617..2,965.629 rows=10 loops=1)

3. 74.126 2,965.616 ↑ 6,625.1 10 1

Sort (cost=247,319.10..247,484.73 rows=66,251 width=2,432) (actual time=2,965.616..2,965.616 rows=10 loops=1)

  • Sort Key: inspections_booking.last_updated_time DESC, inspections_booking.id, inspections_booking.uuid, inspections_booking.assignment_uuid, inspections_booking.inspection_uuid, inspections_booking.pi_number, inspections_booking.country_of_shipment, inspections_booking.inspection_type_id, inspections_booking.shipment_date, inspections_booking.expected_inspection_date, inspections_booking.actual_inspection_date, inspections_booking.status, inspections_booking.case_number, inspections_booking.current_number, inspections_booking.executor_id, inspections_booking.book_to_org_id, inspections_booking.book_from_org_id, inspections_booking.inspection_location_information_id, inspections_booking.supplier_information_id, inspections_booking.factory_information_id, inspections_booking.retailer_information_id, inspections_booking.inspector_id, inspections_booking.tentative_workflow, inspections_booking.workflow_id, inspections_booking.saved_workflow_id, inspections_booking.creator_id, inspections_booking.released_by_user_id, inspections_booking.approved_by_user_id, inspections_booking.confirmed_by_id, inspections_booking.approved_date, inspections_booking.utc_offset, inspections_booking.capa, inspections_booking.created_time, inspections_booking.last_updated_by_id, inspections_booking.remark, inspections_booking.split_from_id, inspections_booking.clone_from_id, inspections_booking.split_allowed, inspections_booking.shared_to_stakeholders, inspections_booking.booking_ids, ((inspections_booking.inspection_location)::bytea), inspections_booking.inspection_location_country, inspections_booking.inspection_location_city, inspections_booking.inspection_location_district, inspections_booking.inspection_start_time, inspections_booking.inspection_end_time, inspections_booking.inspection_total_time, inspections_booking.inspection_result, inspections_booking.inspection_total_quantity, inspections_booking.report_pdf, inspections_booking.description, inspections_booking.tech_pack, inspections_booking.purchase_order, inspections_booking.order_quantity, inspections_booking.available_quantity, inspections_booking.previous_inspection_id, inspections_booking.previous_assignment_id, inspections_booking.previous_booking_id, inspections_booking.only_fail_ppm_question, inspections_booking.booking_template_history_id, inspections_booking.fe_draft_id, inspections_booking.assignment_status, inspections_booking.assignment_executor_id, inspections_booking.auto_assign, inspections_booking.case_id, inspections_booking.inactive_time
  • Sort Method: external merge Disk: 16808kB
4. 204.879 2,891.490 ↑ 1.6 41,360 1

Group (cost=78,476.37..102,972.84 rows=66,251 width=2,432) (actual time=1,166.363..2,891.490 rows=41,360 loops=1)

  • Group Key: inspections_booking.id
5. 844.881 2,686.611 ↓ 29.3 3,018,854 1

Merge Join (cost=78,476.37..101,059.38 rows=102,872 width=2,432) (actual time=1,166.341..2,686.611 rows=3,018,854 loops=1)

  • Merge Cond: (inspections_booking.id = inspections_booking_purchase_orders.booking_id)
6. 278.445 1,471.207 ↓ 19.4 1,036,917 1

Merge Join (cost=45,256.59..66,141.07 rows=53,472 width=2,436) (actual time=959.789..1,471.207 rows=1,036,917 loops=1)

  • Merge Cond: (inspections_booking.id = inspections_bookingitem.booking_id)
7. 90.878 90.878 ↑ 1.0 65,710 1

Index Scan using inspections_booking_pkey on inspections_booking (cost=0.29..20,286.76 rows=66,251 width=2,432) (actual time=0.013..90.878 rows=65,710 loops=1)

  • Filter: ((book_to_org_id = 252437) OR (executor_id = 252437))
  • Rows Removed by Filter: 15808
8. 648.945 1,101.884 ↓ 16.4 1,085,124 1

Sort (cost=45,255.68..45,421.07 rows=66,158 width=4) (actual time=959.769..1,101.884 rows=1,085,124 loops=1)

  • Sort Key: inspections_bookingitem.booking_id
  • Sort Method: external sort Disk: 19104kB
9. 218.234 452.939 ↓ 16.4 1,085,124 1

Hash Join (cost=771.12..39,958.53 rows=66,158 width=4) (actual time=5.234..452.939 rows=1,085,124 loops=1)

  • Hash Cond: (inspections_bookingitem.product_category_id = datasource_productcategory.id)
10. 229.571 229.571 ↑ 1.0 1,486,745 1

Seq Scan on inspections_bookingitem (cost=0.00..32,839.22 rows=1,516,422 width=8) (actual time=0.089..229.571 rows=1,486,745 loops=1)

11. 0.248 5.134 ↓ 1.6 1,814 1

Hash (cost=757.35..757.35 rows=1,101 width=4) (actual time=5.134..5.134 rows=1,814 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 80kB
12. 2.911 4.886 ↓ 1.6 1,814 1

Hash Join (cost=29.36..757.35 rows=1,101 width=4) (actual time=0.263..4.886 rows=1,814 loops=1)

  • Hash Cond: (datasource_productcategory.product_line_id = datasource_productline.id)
13. 1.856 1.856 ↑ 1.0 25,235 1

Seq Scan on datasource_productcategory (cost=0.00..622.35 rows=25,235 width=8) (actual time=0.088..1.856 rows=25,235 loops=1)

14. 0.009 0.119 ↑ 1.0 38 1

Hash (cost=28.89..28.89 rows=38 width=4) (actual time=0.119..0.119 rows=38 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
15. 0.110 0.110 ↑ 1.0 38 1

Seq Scan on datasource_productline (cost=0.00..28.89 rows=38 width=4) (actual time=0.008..0.110 rows=38 loops=1)

  • Filter: ((product_line_id)::text = '540'::text)
  • Rows Removed by Filter: 833
16. 139.843 370.523 ↓ 19.6 3,086,076 1

Materialize (cost=33,219.39..34,007.87 rows=157,696 width=4) (actual time=206.548..370.523 rows=3,086,076 loops=1)

17. 85.989 230.680 ↑ 1.0 157,695 1

Sort (cost=33,219.39..33,613.63 rows=157,696 width=4) (actual time=206.545..230.680 rows=157,695 loops=1)

  • Sort Key: inspections_booking_purchase_orders.booking_id
  • Sort Method: external merge Disk: 2152kB
18. 66.413 144.691 ↑ 1.0 157,696 1

Hash Join (cost=9,406.60..17,448.88 rows=157,696 width=4) (actual time=59.654..144.691 rows=157,696 loops=1)

  • Hash Cond: (inspections_booking_purchase_orders.purchaseorder_id = inspections_purchaseorder.id)
19. 19.161 19.161 ↑ 1.0 157,696 1

Seq Scan on inspections_booking_purchase_orders (cost=0.00..3,861.96 rows=157,696 width=8) (actual time=0.106..19.161 rows=157,696 loops=1)

20. 30.011 59.117 ↓ 1.0 199,700 1

Hash (cost=6,130.71..6,130.71 rows=199,671 width=4) (actual time=59.117..59.117 rows=199,700 loops=1)

  • Buckets: 131072 Batches: 4 Memory Usage: 2793kB
21. 29.106 29.106 ↓ 1.0 199,700 1

Seq Scan on inspections_purchaseorder (cost=0.00..6,130.71 rows=199,671 width=4) (actual time=0.085..29.106 rows=199,700 loops=1)