explain.depesz.com

PostgreSQL's explain analyze made readable

Result: xwG

Settings
# exclusive inclusive rows x rows loops node
1. 0.021 246.313 ↑ 1.0 48 1

Limit (cost=49,597.42..49,598.50 rows=48 width=200) (actual time=246.247..246.313 rows=48 loops=1)

2. 0.026 246.292 ↑ 11.8 48 1

Unique (cost=49,597.42..49,610.11 rows=564 width=200) (actual time=246.246..246.292 rows=48 loops=1)

3. 2.083 246.266 ↑ 11.8 48 1

Sort (cost=49,597.42..49,598.83 rows=564 width=200) (actual time=246.245..246.266 rows=48 loops=1)

  • Sort Key: spree_products.sales_global DESC, spree_products.id, spree_products.available_on, spree_products.updated_at, spree_products.consolidated_sales, spree_products.sales_br, spree_products.case_type_ids, spree_product_case_device_images.image_small_url
  • Sort Method: quicksort Memory: 548kB
4. 2.986 244.183 ↓ 3.0 1,665 1

Nested Loop Left Join (cost=262.71..49,571.65 rows=564 width=200) (actual time=4.014..244.183 rows=1,665 loops=1)

5. 2.547 34.737 ↓ 3.0 1,665 1

Nested Loop (cost=262.28..6,406.36 rows=564 width=77) (actual time=3.933..34.737 rows=1,665 loops=1)

6. 2.172 25.530 ↓ 1.7 1,665 1

Nested Loop (cost=261.99..5,868.31 rows=961 width=77) (actual time=3.923..25.530 rows=1,665 loops=1)

  • Join Filter: (spree_products.id = spree_variants.product_id)
7. 2.169 16.698 ↓ 1.6 1,665 1

Hash Join (cost=261.70..5,169.48 rows=1,031 width=77) (actual time=3.913..16.698 rows=1,665 loops=1)

  • Hash Cond: (spree_products.id = ps.product_id)
8. 10.651 10.651 ↑ 1.2 2,442 1

Seq Scan on spree_products (cost=0.00..4,883.24 rows=2,846 width=73) (actual time=0.021..10.651 rows=2,442 loops=1)

  • Filter: ((deleted_at IS NULL) AND (discontinue_on IS NULL) AND (gift IS NOT TRUE) AND ((product_type_code)::text <> 'adapter'::text) AND ((product_type_code)::text = 'case'::text) AND (184 <> ALL (unsupported_case_device_ids)) AND (((product_type_code)::text <> 'case'::text) OR (1 = ANY (case_type_ids))))
  • Rows Removed by Filter: 10246
9. 1.502 3.878 ↓ 1.0 4,664 1

Hash (cost=204.25..204.25 rows=4,596 width=4) (actual time=3.877..3.878 rows=4,664 loops=1)

  • Buckets: 8192 Batches: 1 Memory Usage: 228kB
10. 2.376 2.376 ↓ 1.0 4,664 1

Seq Scan on spree_products_stores ps (cost=0.00..204.25 rows=4,596 width=4) (actual time=0.006..2.376 rows=4,664 loops=1)

  • Filter: (store_id = 3)
  • Rows Removed by Filter: 7020
11. 6.660 6.660 ↑ 1.0 1 1,665

Index Scan using index_spree_variants_on_product_id on spree_variants (cost=0.29..0.67 rows=1 width=8) (actual time=0.004..0.004 rows=1 loops=1,665)

  • Index Cond: (product_id = ps.product_id)
  • Filter: ((is_master IS TRUE) AND (deleted_at IS NULL))
  • Rows Removed by Filter: 0
12. 6.660 6.660 ↑ 1.0 1 1,665

Index Only Scan using idx_bruno_variant_price_spree on spree_prices (cost=0.29..0.55 rows=1 width=4) (actual time=0.004..0.004 rows=1 loops=1,665)

  • Index Cond: ((variant_id = spree_variants.id) AND (currency = 'EUR'::text))
  • Heap Fetches: 1385
13. 206.460 206.460 ↑ 1.0 1 1,665

Index Scan using index_spree_product_case_device_images_on_variant_id_and_locale on spree_product_case_device_images (cost=0.43..76.52 rows=1 width=131) (actual time=0.078..0.124 rows=1 loops=1,665)

  • Index Cond: ((variant_id = spree_variants.id) AND ((locale)::text = 'en'::text))
  • Filter: (case_device_id = 184)
  • Rows Removed by Filter: 138
Planning time : 1.477 ms
Execution time : 246.401 ms