explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 0ERf

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 5,406.121 ↑ 1.0 10 1

Limit (cost=213,641.48..213,641.51 rows=10 width=2,504) (actual time=5,406.118..5,406.121 rows=10 loops=1)

2. 60.390 5,406.121 ↑ 6,620.9 10 1

Sort (cost=213,641.48..213,807.00 rows=66,209 width=2,504) (actual time=5,406.118..5,406.121 rows=10 loops=1)

  • Sort Key: inspections_booking.last_updated_time DESC
  • Sort Method: top-N heapsort Memory: 33kB
3. 3,101.904 5,345.731 ↑ 1.0 64,974 1

GroupAggregate (cost=34,149.95..212,210.73 rows=66,209 width=2,504) (actual time=251.930..5,345.731 rows=64,974 loops=1)

  • Group Key: inspections_booking.id
4. 1,068.036 2,243.827 ↓ 1.6 3,871,887 1

Merge Join (cost=34,149.95..185,967.93 rows=2,359,444 width=2,447) (actual time=251.858..2,243.827 rows=3,871,887 loops=1)

  • Merge Cond: (inspections_booking.id = inspections_bookingitem.booking_id)
5. 65.820 474.644 ↓ 1.1 137,166 1

Merge Join (cost=34,148.99..56,417.43 rows=127,457 width=2,447) (actual time=251.838..474.644 rows=137,166 loops=1)

  • Merge Cond: (inspections_booking.id = inspections_booking_purchase_orders.booking_id)
6. 105.782 105.782 ↑ 1.0 65,710 1

Index Scan using inspections_booking_pkey on inspections_booking (cost=0.29..20,274.46 rows=66,209 width=2,432) (actual time=0.010..105.782 rows=65,710 loops=1)

  • Filter: ((book_to_org_id = 252437) OR (executor_id = 252437))
  • Rows Removed by Filter: 15809
7. 18.254 303.042 ↑ 1.0 157,696 1

Materialize (cost=34,148.39..34,936.87 rows=157,696 width=15) (actual time=251.822..303.042 rows=157,696 loops=1)

8. 106.221 284.788 ↑ 1.0 157,696 1

Sort (cost=34,148.39..34,542.63 rows=157,696 width=15) (actual time=251.820..284.788 rows=157,696 loops=1)

  • Sort Key: inspections_booking_purchase_orders.booking_id
  • Sort Method: external merge Disk: 3560kB
9. 78.855 178.567 ↑ 1.0 157,696 1

Hash Join (cost=9,601.60..17,838.88 rows=157,696 width=15) (actual time=79.257..178.567 rows=157,696 loops=1)

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

11. 42.419 78.548 ↓ 1.0 199,696 1

Hash (cost=6,130.71..6,130.71 rows=199,671 width=15) (actual time=78.548..78.548 rows=199,696 loops=1)

  • Buckets: 131072 Batches: 4 Memory Usage: 3327kB
12. 36.129 36.129 ↓ 1.0 199,696 1

Seq Scan on inspections_purchaseorder (cost=0.00..6,130.71 rows=199,671 width=15) (actual time=0.087..36.129 rows=199,696 loops=1)

13. 300.814 701.147 ↓ 2.6 4,003,376 1

Materialize (cost=0.43..98,108.84 rows=1,516,422 width=8) (actual time=0.019..701.147 rows=4,003,376 loops=1)

14. 400.333 400.333 ↑ 1.0 1,486,711 1

Index Scan using inspections_bookingitem_booking_id_581db468 on inspections_bookingitem (cost=0.43..94,317.78 rows=1,516,422 width=8) (actual time=0.016..400.333 rows=1,486,711 loops=1)

Planning time : 1.216 ms