explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 7u58

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

Limit (cost=6,344.64..6,345.60 rows=48 width=73) (actual time=26.279..26.348 rows=48 loops=1)

2. 0.034 26.322 ↑ 10.4 48 1

Unique (cost=6,344.64..6,354.60 rows=498 width=73) (actual time=26.278..26.322 rows=48 loops=1)

3. 1.246 26.288 ↑ 10.4 48 1

Sort (cost=6,344.64..6,345.89 rows=498 width=73) (actual time=26.277..26.288 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.493 25.042 ↓ 3.2 1,600 1

Nested Loop (cost=262.28..6,322.33 rows=498 width=73) (actual time=3.513..25.042 rows=1,600 loops=1)

5. 2.440 18.749 ↓ 1.9 1,600 1

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

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

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

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

Seq Scan on spree_products (cost=0.00..4,946.63 rows=2,512 width=73) (actual time=0.031..8.375 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: 10455
8. 1.323 3.448 ↓ 1.0 4,664 1

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

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

  • Filter: (store_id = 3)
  • Rows Removed by Filter: 7020
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 Only Scan using idx_bruno_variant_price_spree on spree_prices (cost=0.29..0.55 rows=1 width=4) (actual time=0.003..0.003 rows=1 loops=1,600)

  • Index Cond: ((variant_id = spree_variants.id) AND (currency = 'EUR'::text))
  • Heap Fetches: 1326
Planning time : 0.930 ms
Execution time : 26.419 ms