explain.depesz.com

PostgreSQL's explain analyze made readable

Result: D9jV

Settings
# exclusive inclusive rows x rows loops node
1. 0.004 31.153 ↑ 1.0 1 1

Unique (cost=7,225.52..7,225.53 rows=1 width=8) (actual time=31.152..31.153 rows=1 loops=1)

2. 0.018 31.149 ↑ 1.0 1 1

Sort (cost=7,225.52..7,225.53 rows=1 width=8) (actual time=31.148..31.149 rows=1 loops=1)

  • Sort Key: (count(DISTINCT spree_products.id))
  • Sort Method: quicksort Memory: 25kB
3. 0.807 31.131 ↑ 1.0 1 1

Aggregate (cost=7,225.50..7,225.51 rows=1 width=8) (actual time=31.130..31.131 rows=1 loops=1)

4. 1.321 30.324 ↑ 2.0 1,213 1

Nested Loop (cost=291.47..7,219.37 rows=2,455 width=4) (actual time=5.239..30.324 rows=1,213 loops=1)

5. 0.451 26.739 ↑ 2.9 283 1

Nested Loop (cost=291.18..6,886.93 rows=813 width=16) (actual time=4.746..26.739 rows=283 loops=1)

6. 0.545 25.156 ↑ 2.9 283 1

Nested Loop (cost=290.89..6,502.10 rows=822 width=12) (actual time=4.734..25.156 rows=283 loops=1)

7. 0.690 22.630 ↑ 3.0 283 1

Nested Loop (cost=290.60..5,998.28 rows=863 width=16) (actual time=4.703..22.630 rows=283 loops=1)

  • Join Filter: (spree_products.id = spree_variants.product_id)
8. 1.055 20.242 ↑ 3.3 283 1

Hash Join (cost=290.31..5,498.60 rows=924 width=8) (actual time=4.691..20.242 rows=283 loops=1)

  • Hash Cond: (spree_products.id = ps.product_id)
9. 14.577 14.577 ↑ 1.5 1,164 1

Seq Scan on spree_products (cost=0.00..5,190.12 rows=1,784 width=4) (actual time=0.023..14.577 rows=1,164 loops=1)

  • Filter: ((deleted_at IS NULL) AND (discontinue_on IS NOT NULL) AND (gift IS NOT TRUE) AND (available_on <= '2019-11-26 00:00:00'::timestamp without time zone) AND ((product_type_code)::text <> 'gift'::text) AND (10 <> ALL (unsupported_case_device_ids)) AND (((product_type_code)::text <> 'case'::text) OR (1 = ANY (case_type_ids))))
  • Rows Removed by Filter: 11733
10. 2.013 4.610 ↑ 1.0 6,675 1

Hash (cost=206.79..206.79 rows=6,682 width=4) (actual time=4.609..4.610 rows=6,675 loops=1)

  • Buckets: 8192 Batches: 1 Memory Usage: 299kB
11. 2.597 2.597 ↑ 1.0 6,675 1

Seq Scan on spree_products_stores ps (cost=0.00..206.79 rows=6,682 width=4) (actual time=0.008..2.597 rows=6,675 loops=1)

  • Filter: (store_id = 1)
  • Rows Removed by Filter: 4823
12. 1.698 1.698 ↑ 1.0 1 283

Index Scan using index_spree_variants_on_product_id on spree_variants (cost=0.29..0.53 rows=1 width=8) (actual time=0.005..0.006 rows=1 loops=283)

  • Index Cond: (product_id = ps.product_id)
  • Filter: ((is_master IS TRUE) AND (deleted_at IS NULL))
  • Rows Removed by Filter: 3
13. 1.981 1.981 ↑ 1.0 1 283

Index Only Scan using idx_bruno_variant_price_spree on spree_prices (cost=0.29..0.57 rows=1 width=4) (actual time=0.005..0.007 rows=1 loops=283)

  • Index Cond: ((variant_id = spree_variants.id) AND (currency = 'BRL'::text))
  • Heap Fetches: 453
14. 1.132 1.132 ↑ 1.0 1 283

Index Only Scan using idx_bruno_product_translations_pt on spree_product_translations (cost=0.29..0.46 rows=1 width=4) (actual time=0.003..0.004 rows=1 loops=283)

  • Index Cond: (spree_product_id = spree_variants.product_id)
  • Heap Fetches: 137
15. 2.264 2.264 ↓ 1.3 4 283

Index Only Scan using index_spree_products_taxons_on_product_id on spree_products_taxons (cost=0.29..0.38 rows=3 width=4) (actual time=0.005..0.008 rows=4 loops=283)

  • Index Cond: (product_id = spree_variants.product_id)
  • Heap Fetches: 612
Planning time : 4.557 ms
Execution time : 31.302 ms