explain.depesz.com

PostgreSQL's explain analyze made readable

Result: QKkn

Settings
# exclusive inclusive rows x rows loops node
1. 0.056 5,699.601 ↓ 0.0 0 1

Hash Join (cost=437,838.25..437,839.92 rows=1 width=73) (actual time=5,699.601..5,699.601 rows=0 loops=1)

  • Hash Cond: (oius.unique_sku_id = unique_skus.id)
2.          

CTE order_invoice_unique_skus

3. 1.996 596.256 ↑ 70.0 1 1

HashAggregate (cost=86,248.53..86,249.23 rows=70 width=8) (actual time=596.256..596.256 rows=1 loops=1)

  • Group Key: vi.unique_sku_id
4. 3.400 594.260 ↓ 8.0 560 1

Append (cost=0.43..86,248.36 rows=70 width=8) (actual time=161.101..594.260 rows=560 loops=1)

5. 0.023 159.010 ↓ 0.0 0 1

Nested Loop (cost=0.43..32,180.26 rows=3 width=8) (actual time=159.010..159.010 rows=0 loops=1)

6. 158.973 158.973 ↑ 1.0 1 1

Seq Scan on purchase_orders po (cost=0.00..31,584.22 rows=1 width=8) (actual time=28.465..158.973 rows=1 loops=1)

  • Filter: (name = 'LAS44263ST'::text)
  • Rows Removed by Filter: 1228988
7. 0.014 0.014 ↓ 0.0 0 1

Index Scan using idx_vendor_items_purchase_order_id on vendor_items vi (cost=0.43..593.56 rows=248 width=16) (actual time=0.014..0.014 rows=0 loops=1)

  • Index Cond: (purchase_order_id = po.id)
8. 3.563 431.850 ↓ 8.4 560 1

Nested Loop (cost=0.43..54,067.39 rows=67 width=8) (actual time=2.080..431.850 rows=560 loops=1)

9. 426.233 426.233 ↑ 1.2 13 1

Seq Scan on distributor_invoices di (cost=0.00..53,849.98 rows=15 width=8) (actual time=2.042..426.233 rows=13 loops=1)

  • Filter: (purchase_order_number = 'LAS44263ST'::text)
  • Rows Removed by Filter: 1548625
10. 2.054 2.054 ↓ 1.6 43 13

Index Scan using fki_dili_distributor_invoice_id on distributor_invoice_line_items dili (cost=0.43..14.22 rows=27 width=16) (actual time=0.012..0.158 rows=43 loops=13)

  • Index Cond: (distributor_invoice_id = di.id)
11. 596.265 596.265 ↑ 70.0 1 1

CTE Scan on order_invoice_unique_skus oius (cost=0.00..1.40 rows=70 width=8) (actual time=596.265..596.265 rows=1 loops=1)

12. 0.006 5,103.280 ↓ 0.0 0 1

Hash (cost=351,589.00..351,589.00 rows=1 width=81) (actual time=5,103.280..5,103.280 rows=0 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
13. 0.051 5,103.274 ↓ 0.0 0 1

Nested Loop (cost=351,572.45..351,589.00 rows=1 width=81) (actual time=5,103.274..5,103.274 rows=0 loops=1)

14. 0.036 5,103.168 ↓ 2.5 5 1

Unique (cost=351,572.02..351,572.03 rows=2 width=8) (actual time=5,103.127..5,103.168 rows=5 loops=1)

15. 0.092 5,103.132 ↓ 2.5 5 1

Sort (cost=351,572.02..351,572.02 rows=2 width=8) (actual time=5,103.120..5,103.132 rows=5 loops=1)

  • Sort Key: us2.id
  • Sort Method: quicksort Memory: 25kB
16. 0.046 5,103.040 ↓ 2.5 5 1

Append (cost=0.43..351,572.01 rows=2 width=8) (actual time=3.286..5,103.040 rows=5 loops=1)

17. 0.305 3,166.694 ↓ 5.0 5 1

Nested Loop (cost=0.43..157,852.58 rows=1 width=8) (actual time=3.278..3,166.694 rows=5 loops=1)

18. 3,166.099 3,166.099 ↓ 29.0 29 1

Seq Scan on vendor_items vi2 (cost=0.00..157,844.12 rows=1 width=8) (actual time=3.119..3,166.099 rows=29 loops=1)

  • Filter: ((received_at IS NOT NULL) AND (received_at >= '2018-11-01 00:00:00+00'::timestamp with time zone) AND (received_at <= '2018-11-09 00:00:00+00'::timestamp with time zone))
  • Rows Removed by Filter: 4111526
19. 0.290 0.290 ↓ 0.0 0 29

Index Only Scan using unique_skus_pkey on unique_skus us2 (cost=0.43..8.45 rows=1 width=8) (actual time=0.009..0.010 rows=0 loops=29)

  • Index Cond: (id = vi2.unique_sku_id)
  • Heap Fetches: 5
20. 0.007 1,936.300 ↓ 0.0 0 1

Nested Loop (cost=0.43..193,719.40 rows=1 width=8) (actual time=1,936.300..1,936.300 rows=0 loops=1)

21. 1,936.293 1,936.293 ↓ 0.0 0 1

Seq Scan on distributor_invoice_line_items dili2 (cost=0.00..193,710.94 rows=1 width=8) (actual time=1,936.293..1,936.293 rows=0 loops=1)

  • Filter: ((received_at IS NOT NULL) AND (received_at >= '2018-11-01 00:00:00+00'::timestamp with time zone) AND (received_at <= '2018-11-09 00:00:00+00'::timestamp with time zone))
  • Rows Removed by Filter: 6882996
22. 0.000 0.000 ↓ 0.0 0

Index Only Scan using unique_skus_pkey on unique_skus us3 (cost=0.43..8.45 rows=1 width=8) (never executed)

  • Index Cond: (id = dili2.unique_sku_id)
  • Heap Fetches: 0
23. 0.055 0.055 ↓ 0.0 0 5

Index Scan using unique_skus_pkey on unique_skus (cost=0.43..8.47 rows=1 width=73) (actual time=0.011..0.011 rows=0 loops=5)

  • Index Cond: (id = us2.id)
  • Filter: ((distributor_id = 50) AND (inventory_status_id = ANY ('{1,2,3,4,5,6,7,8,9,10,11,12,13}'::smallint[])))
  • Rows Removed by Filter: 1