explain.depesz.com

PostgreSQL's explain analyze made readable

Result: rSm9

Settings
# exclusive inclusive rows x rows loops node
1. 0.009 1,528.658 ↑ 1.0 1 1

Aggregate (cost=71,708.98..71,708.99 rows=1 width=8) (actual time=1,528.657..1,528.658 rows=1 loops=1)

2. 0.017 1,528.649 ↓ 1.9 50 1

Unique (cost=71,708.03..71,708.64 rows=27 width=68) (actual time=1,528.622..1,528.649 rows=50 loops=1)

3. 0.174 1,528.632 ↓ 3.2 86 1

Sort (cost=71,708.03..71,708.10 rows=27 width=68) (actual time=1,528.621..1,528.632 rows=86 loops=1)

  • Sort Key: performance_purchaseorder.id, performance_purchaseorder.original_id, performance_purchaseorder.delivery_at, performance_purchaseorder.owner_id, performance_purchaseorder.factory_id, performance_purchaseorder.supplier_id, performance_purchaseorder.retailer_id, performance_purchaseorder.updated_at
  • Sort Method: quicksort Memory: 37kB
4. 0.065 1,528.458 ↓ 3.2 86 1

Nested Loop (cost=38,282.00..71,707.39 rows=27 width=68) (actual time=948.769..1,528.458 rows=86 loops=1)

  • Join Filter: (performance_purchaseorder.id = performance_booking_purchase_orders.purchaseorder_id)
5. 0.068 1,528.145 ↓ 1.8 62 1

Nested Loop (cost=38,281.57..71,687.02 rows=34 width=84) (actual time=948.747..1,528.145 rows=62 loops=1)

6. 0.133 1,527.573 ↑ 6.0 63 1

Nested Loop (cost=38,281.15..71,485.59 rows=377 width=100) (actual time=597.508..1,527.573 rows=63 loops=1)

7. 666.058 1,525.935 ↑ 2.2 215 1

Hash Right Join (cost=38,280.72..71,122.10 rows=466 width=68) (actual time=597.488..1,525.935 rows=215 loops=1)

  • Hash Cond: (performance_purchaseorder_shared_organizations.purchaseorder_id = performance_purchaseorder.id)
  • Filter: ((performance_purchaseorder.owner_id = 292218) OR (performance_purchaseorder_shared_organizations.organization_id = 292218))
  • Rows Removed by Filter: 212670
8. 275.099 275.099 ↓ 1.0 1,463,329 1

Seq Scan on performance_purchaseorder_shared_organizations (cost=0.00..23,672.96 rows=1,426,996 width=20) (actual time=0.014..275.099 rows=1,463,329 loops=1)

9. 123.211 584.778 ↓ 1.0 145,534 1

Hash (cost=36,473.89..36,473.89 rows=144,547 width=68) (actual time=584.778..584.778 rows=145,534 loops=1)

  • Buckets: 262144 Batches: 1 Memory Usage: 16393kB
10. 461.567 461.567 ↓ 1.0 145,534 1

Seq Scan on performance_purchaseorder (cost=0.00..36,473.89 rows=144,547 width=68) (actual time=0.350..461.567 rows=145,534 loops=1)

  • Filter: (delivery_at > '2020-03-20'::date)
  • Rows Removed by Filter: 665859
11. 1.505 1.505 ↓ 0.0 0 215

Index Scan using performance_booking_purchase_orders_purchaseorder_id_194c36ca on performance_booking_purchase_orders t7 (cost=0.42..0.74 rows=4 width=32) (actual time=0.007..0.007 rows=0 loops=215)

  • Index Cond: (purchaseorder_id = performance_purchaseorder.id)
12. 0.504 0.504 ↑ 1.0 1 63

Index Scan using performance_booking_pkey on performance_booking t8 (cost=0.42..0.52 rows=1 width=16) (actual time=0.008..0.008 rows=1 loops=63)

  • Index Cond: (id = t7.booking_id)
  • Filter: ((created_at >= '2020-02-19'::date) AND (created_at <= '2020-03-19'::date))
  • Rows Removed by Filter: 0
13. 0.248 0.248 ↑ 4.0 1 62

Index Scan using performance_booking_purchase_orders_purchaseorder_id_194c36ca on performance_booking_purchase_orders (cost=0.42..0.55 rows=4 width=16) (actual time=0.003..0.004 rows=1 loops=62)

  • Index Cond: (purchaseorder_id = t7.purchaseorder_id)
  • Filter: (booking_id IS NOT NULL)
Planning time : 2.112 ms
Execution time : 1,528.848 ms