explain.depesz.com

PostgreSQL's explain analyze made readable

Result: GRSm

Settings
# exclusive inclusive rows x rows loops node
1. 0.002 61,882.687 ↑ 1.0 10 1

Limit (cost=328,089.53..328,091.20 rows=10 width=2,432) (actual time=61,881.698..61,882.687 rows=10 loops=1)

2. 0.872 61,882.685 ↑ 10,287.2 10 1

Unique (cost=328,089.53..345,320.59 rows=102,872 width=2,432) (actual time=61,881.697..61,882.685 rows=10 loops=1)

3. 58,227.150 61,881.813 ↑ 163.3 630 1

Sort (cost=328,089.53..328,346.71 rows=102,872 width=2,432) (actual time=61,881.696..61,881.813 rows=630 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: 1294848kB
4. 1,768.322 3,654.663 ↓ 29.3 3,018,854 1

Merge Join (cost=78,476.37..103,631.18 rows=102,872 width=2,432) (actual time=1,179.848..3,654.663 rows=3,018,854 loops=1)

  • Merge Cond: (inspections_booking.id = inspections_booking_purchase_orders.booking_id)
5. 290.432 1,492.911 ↓ 19.4 1,036,917 1

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

  • Merge Cond: (inspections_booking.id = inspections_bookingitem.booking_id)
6. 109.405 109.405 ↑ 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.012..109.405 rows=65,710 loops=1)

  • Filter: ((book_to_org_id = 252437) OR (executor_id = 252437))
  • Rows Removed by Filter: 15808
7. 631.730 1,093.074 ↓ 16.4 1,085,124 1

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

  • Sort Key: inspections_bookingitem.booking_id
  • Sort Method: external sort Disk: 19104kB
8. 222.465 461.344 ↓ 16.4 1,085,124 1

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

  • Hash Cond: (inspections_bookingitem.product_category_id = datasource_productcategory.id)
9. 233.716 233.716 ↑ 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.088..233.716 rows=1,486,745 loops=1)

10. 0.262 5.163 ↓ 1.6 1,814 1

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

  • Buckets: 2048 Batches: 1 Memory Usage: 80kB
11. 3.022 4.901 ↓ 1.6 1,814 1

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

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

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

13. 0.012 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
14. 0.107 0.107 ↑ 1.0 38 1

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

  • Filter: ((product_line_id)::text = '540'::text)
  • Rows Removed by Filter: 833
15. 151.995 393.430 ↓ 19.6 3,086,076 1

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

16. 90.566 241.435 ↑ 1.0 157,695 1

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

  • Sort Key: inspections_booking_purchase_orders.booking_id
  • Sort Method: external merge Disk: 2152kB
17. 71.486 150.869 ↑ 1.0 157,696 1

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

  • Hash Cond: (inspections_booking_purchase_orders.purchaseorder_id = inspections_purchaseorder.id)
18. 20.016 20.016 ↑ 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.094..20.016 rows=157,696 loops=1)

19. 30.071 59.367 ↓ 1.0 199,700 1

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

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

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