explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 161k

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

Limit (cost=6,508.83..6,509.79 rows=48 width=73) (actual time=27.528..27.596 rows=48 loops=1)

2. 0.034 27.575 ↑ 10.4 48 1

Unique (cost=6,508.83..6,518.81 rows=499 width=73) (actual time=27.528..27.575 rows=48 loops=1)

3. 1.272 27.541 ↑ 10.4 48 1

Sort (cost=6,508.83..6,510.08 rows=499 width=73) (actual time=27.526..27.541 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.530 26.269 ↓ 3.2 1,600 1

Nested Loop (cost=262.28..6,486.47 rows=499 width=73) (actual time=3.561..26.269 rows=1,600 loops=1)

5. 2.373 19.939 ↓ 1.9 1,600 1

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

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

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

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

Seq Scan on spree_products (cost=0.00..4,995.41 rows=2,717 width=73) (actual time=0.014..9.652 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
8. 1.355 3.492 ↓ 1.0 4,664 1

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

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

  • Filter: (store_id = 3)
  • Rows Removed by Filter: 7007
10. 3.200 3.200 ↑ 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.002..0.002 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. 4.800 4.800 ↑ 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.003 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 : 0.963 ms
Execution time : 27.705 ms