Skip to content

Instantly share code, notes, and snippets.

@joevandyk
Created March 26, 2014 07:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joevandyk/9778426 to your computer and use it in GitHub Desktop.
Save joevandyk/9778426 to your computer and use it in GitHub Desktop.
Sort (cost=514690.51..514940.51 rows=100000 width=2548) (actual time=20856.993..20991.397 rows=100000 loops=1)
Sort Key: data.line_item_internal_id, data.shipment_picked_up_at
Sort Method: external merge Disk: 53536kB
CTE data
-> Limit (cost=2160.08..394324.69 rows=100000 width=904) (actual time=15.456..20009.395 rows=100000 loops=1)
-> Nested Loop Left Join (cost=2160.08..16722360.84 rows=4263567 width=904) (actual time=15.455..19990.996 rows=100000 loops=1)
-> Hash Left Join (cost=2159.22..10424474.68 rows=4016402 width=792) (actual time=14.872..14675.085 rows=99204 loops=1)
Hash Cond: (pl.shipping_export_id = se.id)
-> Nested Loop Left Join (cost=3.28..10347011.19 rows=4016402 width=767) (actual time=0.145..14552.755 rows=99204 loops=1)
-> Nested Loop Left Join (cost=2.85..8305866.58 rows=4016402 width=739) (actual time=0.143..13375.717 rows=99204 loops=1)
-> Nested Loop (cost=2.42..6211430.67 rows=4016402 width=703) (actual time=0.132..12702.586 rows=99204 loops=1)
-> Nested Loop (cost=2.12..4896846.03 rows=4016402 width=646) (actual time=0.119..12371.136 rows=99204 loops=1)
Join Filter: (o.id = osa.order_id)
-> Nested Loop (cost=1.69..2847160.10 rows=4016402 width=586) (actual time=0.103..9130.379 rows=99204 loops=1)
-> Merge Join (cost=1.26..534215.18 rows=4016402 width=469) (actual time=0.083..1874.678 rows=99204 loops=1)
Merge Cond: (skus.id = li.sku_id)
-> Nested Loop (cost=0.83..80077.82 rows=119536 width=414) (actual time=0.063..77.779 rows=8808 loops=1)
-> Index Scan using skus_id_product_id_idx on skus (cost=0.42..14045.46 rows=119536 width=405) (actual time=0.037..20.022 rows=8808 loops=1)
-> Index Scan using base_skus_pkey on base_skus bs (cost=0.42..0.54 rows=1 width=25) (actual time=0.005..0.006 rows=1 loops=8808)
Index Cond: (base_sku_id = skus.base_sku_id)
-> Index Scan using line_items_sku_id_idx on line_items li (cost=0.43..403633.50 rows=4016402 width=59) (actual time=0.015..1707.721 rows=99204 loops=1)
-> Index Scan using orders_pkey on orders o (cost=0.43..0.57 rows=1 width=117) (actual time=0.072..0.072 rows=1 loops=99204)
Index Cond: (id = li.order_id)
-> Index Scan using order_shipping_addresses_pkey on order_shipping_addresses osa (cost=0.43..0.50 rows=1 width=68) (actual time=0.031..0.031 rows=1 loops=99204)
Index Cond: (order_id = li.order_id)
-> Index Scan using products_pkey on products p (cost=0.29..0.32 rows=1 width=57) (actual time=0.002..0.002 rows=1 loops=99204)
Index Cond: (id = li.product_id)
-> Index Scan using packing_list_items_line_item_id_idx on packing_list_items pli (cost=0.43..0.51 rows=1 width=40) (actual time=0.006..0.006 rows=1 loops=99204)
Index Cond: (li.id = line_item_id)
-> Index Scan using packing_lists_pkey on packing_lists pl (cost=0.43..0.50 rows=1 width=36) (actual time=0.011..0.011 rows=1 loops=99204)
Index Cond: (id = pli.packing_list_id)
-> Hash (cost=1883.66..1883.66 rows=21783 width=29) (actual time=14.698..14.698 rows=21783 loops=1)
Buckets: 4096 Batches: 1 Memory Usage: 1282kB
-> Merge Right Join (cost=0.56..1883.66 rows=21783 width=29) (actual time=0.030..10.520 rows=21783 loops=1)
Merge Cond: (ds.id = se.drop_shipper_id)
-> Index Scan using drop_shippers_pkey on drop_shippers ds (cost=0.28..83.04 rows=520 width=25) (actual time=0.016..0.232 rows=517 loops=1)
-> Index Scan using shipping_exports_drop_shipper_id on shipping_exports se (cost=0.29..1527.03 rows=21783 width=8) (actual time=0.013..6.588 rows=21783 loops=1)
-> Nested Loop Left Join (cost=0.86..1.02 rows=1 width=144) (actual time=0.030..0.031 rows=1 loops=99204)
-> Index Only Scan using packing_list_items_shipments_pkey on packing_list_items_shipments plis (cost=0.43..0.50 rows=1 width=20) (actual time=0.016..0.016 rows=1 loops=99204)
Index Cond: (packing_list_item_id = pli.packing_list_item_id)
Heap Fetches: 80938
-> Index Scan using temp_shipments_pkey on shipments s (cost=0.43..0.51 rows=1 width=132) (actual time=0.017..0.017 rows=1 loops=80938)
Index Cond: (id = plis.shipment_id)
-> CTE Scan on data (cost=0.00..2000.00 rows=100000 width=2548) (actual time=15.464..20477.240 rows=100000 loops=1)
Total runtime: 21263.114 ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment