explain.depesz.com

PostgreSQL's explain analyze made readable

Result: OjDO

Settings
# exclusive inclusive rows x rows loops node
1. 0.027 226.004 ↑ 1.0 48 1

Limit (cost=44,709.42..44,710.50 rows=48 width=200) (actual time=225.933..226.004 rows=48 loops=1)

2. 0.024 225.977 ↑ 10.4 48 1

Unique (cost=44,709.42..44,720.64 rows=499 width=200) (actual time=225.932..225.977 rows=48 loops=1)

3. 2.114 225.953 ↑ 10.4 48 1

Sort (cost=44,709.42..44,710.66 rows=499 width=200) (actual time=225.932..225.953 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: 532kB
4. 2.583 223.839 ↓ 3.2 1,600 1

Nested Loop Left Join (cost=262.71..44,687.05 rows=499 width=200) (actual time=3.657..223.839 rows=1,600 loops=1)

5. 2.239 32.456 ↓ 3.2 1,600 1

Nested Loop (cost=262.28..6,486.47 rows=499 width=77) (actual time=3.570..32.456 rows=1,600 loops=1)

6. 1.394 23.817 ↓ 1.9 1,600 1

Nested Loop (cost=261.99..5,897.30 rows=858 width=77) (actual time=3.559..23.817 rows=1,600 loops=1)

  • Join Filter: (spree_products.id = spree_variants.product_id)
7. 1.935 16.023 ↓ 1.8 1,600 1

Hash Join (cost=261.70..5,279.81 rows=911 width=77) (actual time=3.549..16.023 rows=1,600 loops=1)

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

Seq Scan on spree_products (cost=0.00..4,995.41 rows=2,717 width=73) (actual time=0.016..10.593 rows=2,234 loops=1)

  • Filter: ((deleted_at IS NULL) AND (gift IS NOT TRUE) AND ((discontinue_on IS NULL) OR (discontinue_on >= '2019-11-07 11:05:11.28812'::timestamp without time zone)) AND (available_on <= '2019-11-07 11:05:11.288049'::timestamp without time zone) 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: 10441
9. 1.361 3.495 ↓ 1.0 4,664 1

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

  • Buckets: 8192 Batches: 1 Memory Usage: 228kB
10. 2.134 2.134 ↓ 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.010..2.134 rows=4,664 loops=1)

  • Filter: (store_id = 3)
  • Rows Removed by Filter: 7007
11. 6.400 6.400 ↑ 1.0 1 1,600

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

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

Index Scan using index_spree_prices_on_variant_id_and_currency on spree_prices (cost=0.29..0.68 rows=1 width=4) (actual time=0.004..0.004 rows=1 loops=1,600)

  • Index Cond: ((variant_id = spree_variants.id) AND ((currency)::text = 'EUR'::text))
  • Filter: ((deleted_at IS NULL) AND (amount IS NOT NULL))
13. 188.800 188.800 ↑ 1.0 1 1,600

Index Scan using index_spree_product_case_device_images_on_variant_id_and_locale on spree_product_case_device_images (cost=0.43..76.54 rows=1 width=131) (actual time=0.074..0.118 rows=1 loops=1,600)

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