explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Wm3C

Settings
# exclusive inclusive rows x rows loops node
1. 0.026 31.557 ↑ 1.0 48 1

Limit (cost=6,451.84..6,452.80 rows=48 width=73) (actual time=31.483..31.557 rows=48 loops=1)

2. 0.039 31.531 ↑ 10.3 48 1

Unique (cost=6,451.84..6,461.70 rows=493 width=73) (actual time=31.482..31.531 rows=48 loops=1)

3. 1.330 31.492 ↑ 10.3 48 1

Sort (cost=6,451.84..6,453.07 rows=493 width=73) (actual time=31.481..31.492 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
  • Sort Method: quicksort Memory: 292kB
4. 1.135 30.162 ↓ 3.2 1,600 1

Nested Loop (cost=262.28..6,429.79 rows=493 width=73) (actual time=3.685..30.162 rows=1,600 loops=1)

5. 1.479 22.627 ↓ 1.9 1,600 1

Nested Loop (cost=261.99..5,846.80 rows=849 width=77) (actual time=3.661..22.627 rows=1,600 loops=1)

  • Join Filter: (spree_products.id = spree_variants.product_id)
6. 1.528 16.348 ↓ 1.8 1,600 1

Hash Join (cost=261.70..5,229.99 rows=910 width=77) (actual time=3.648..16.348 rows=1,600 loops=1)

  • Hash Cond: (spree_products.id = ps.product_id)
7. 11.252 11.252 ↑ 1.1 2,233 1

Seq Scan on spree_products (cost=0.00..4,946.63 rows=2,512 width=73) (actual time=0.041..11.252 rows=2,233 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: 10454
8. 1.408 3.568 ↓ 1.0 4,664 1

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

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

  • Filter: (store_id = 3)
  • Rows Removed by Filter: 7019
10. 4.800 4.800 ↑ 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.003 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
11. 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.003..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))
Planning time : 2.625 ms
Execution time : 31.701 ms