Skip to content

Instantly share code, notes, and snippets.

@shofetim
Created March 13, 2015 22:00
Show Gist options
  • Select an option

  • Save shofetim/522fa6144da65c1cac01 to your computer and use it in GitHub Desktop.

Select an option

Save shofetim/522fa6144da65c1cac01 to your computer and use it in GitHub Desktop.
Unique (cost=116492999.88..116496326.61 rows=39138 width=399) (actual time=241672.003..241719.254 rows=2515 loops=1)
-> Sort (cost=116492999.88..116493097.73 rows=39138 width=399) (actual time=241671.998..241703.397 rows=11561 loops=1)
Sort Key: products_product.cached_name, products_product.id, products_product.created_at, products_product.created_by, products_product.updated_at, products_product.updated_by, products_product._aggregate_searchable_field, products_product.bargain_bin_location_id, products_product.piece_id, products_product.allow_partial_sale, products_product.code, products_product.is_active, products_product.quantity, products_product.bargain_bin_notes, products_product.cached_brand_id, products_product.cached_primary_imagefield, products_product.name_recalculation_needed, products_product.cached_size, products_product.size_recalculation_needed, products_product.cached_retail_price_display, products_product.retail_price_display_recalculation_needed, products_product.retail_price_display_expires_after, products_product.cached_wholesale_price, products_product.wholesale_price_recalculation_needed, products_product.wholesale_price_expires_after, products_product.cached_wholesale_price_display, products_product.wholesale_price_display_recalculation_needed, products_product.wholesale_price_display_expires_after, products_product.cached_quantity_on_next_purchase, products_product.quantity_on_next_purchase_recalculation_needed, products_product.cached_retail_price, products_product.retail_price_recalculation_needed, products_product.retail_price_expires_after
Sort Method: external merge Disk: 3776kB
-> Merge Join (cost=7389.31..116475832.38 rows=39138 width=399) (actual time=340.790..240970.298 rows=11561 loops=1)
Merge Cond: (products_product.id = products_productprice.product_id)
-> Index Scan using products_product_pkey on products_product (cost=7388.89..116467352.81 rows=12459 width=399) (actual time=322.619..240496.985 rows=2523 loops=1)
Filter: (((NOT (SubPlan 5)) OR (NOT (SubPlan 6))) AND ((NOT (hashed SubPlan 1)) OR (NOT (hashed SubPlan 2)) OR (NOT (SubPlan 3)) OR (NOT (SubPlan 4))))
Rows Removed by Filter: 15197
SubPlan 5
-> Materialize (cost=0.00..2908.87 rows=85244 width=4) (actual time=0.002..4.376 rows=29592 loops=17720)
-> Seq Scan on products_productstatus u1_4 (cost=0.00..2149.65 rows=85244 width=4) (actual time=0.604..64.471 rows=85252 loops=1)
Filter: ((product_id IS NOT NULL) AND (start_date <= '2015-03-13 12:30:38.709694'::timestamp without time zone))
SubPlan 6
-> Materialize (cost=0.00..3258.65 rows=76548 width=4) (actual time=0.002..3.232 rows=21806 loops=15901)
-> Seq Scan on products_productstatus u1_5 (cost=0.00..2575.91 rows=76548 width=4) (actual time=0.008..25.470 rows=76443 loops=1)
Filter: ((product_id IS NOT NULL) AND (status = ANY ('{3,8,6,7,5,2}'::integer[])))
Rows Removed by Filter: 8809
SubPlan 1
-> Hash Right Join (cost=1255.70..5216.95 rows=8187 width=4) (actual time=66.022..133.917 rows=9973 loops=1)
Hash Cond: (u1.product_id = u0.id)
Filter: (u1.end_date IS NULL)
Rows Removed by Filter: 77098
-> Seq Scan on products_productstatus u1 (cost=0.00..1936.52 rows=85252 width=12) (actual time=0.004..11.355 rows=85252 loops=1)
-> Hash (cost=1034.20..1034.20 rows=17720 width=4) (actual time=65.966..65.966 rows=17720 loops=1)
Buckets: 2048 Batches: 1 Memory Usage: 623kB
-> Seq Scan on products_product u0 (cost=0.00..1034.20 rows=17720 width=4) (actual time=0.432..60.678 rows=17720 loops=1)
Filter: (id IS NOT NULL)
SubPlan 2
-> Seq Scan on products_productstatus u1_1 (cost=0.00..2149.65 rows=612 width=4) (actual time=10.143..14.444 rows=52 loops=1)
Filter: ((product_id IS NOT NULL) AND (end_date >= '2015-03-13 12:30:38.709694'::timestamp without time zone))
Rows Removed by Filter: 85200
SubPlan 3
-> Materialize (cost=0.00..2908.87 rows=85244 width=4) (never executed)
-> Seq Scan on products_productstatus u1_2 (cost=0.00..2149.65 rows=85244 width=4) (never executed)
Filter: ((product_id IS NOT NULL) AND (start_date <= '2015-03-13 12:30:38.709694'::timestamp without time zone))
SubPlan 4
-> Materialize (cost=0.00..3258.65 rows=76548 width=4) (never executed)
-> Seq Scan on products_productstatus u1_3 (cost=0.00..2575.91 rows=76548 width=4) (never executed)
Filter: ((product_id IS NOT NULL) AND (status = ANY ('{3,8,6,7,5,2}'::integer[])))
-> Index Scan using products_productprice_product_id on products_productprice (cost=0.42..7917.88 rows=55664 width=4) (actual time=0.016..452.393 rows=55702 loops=1)
Filter: ((start_date < '2015-03-13 12:30:38.709694+00'::timestamp with time zone) AND (price_level = 1))
Rows Removed by Filter: 55915
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment