explain.depesz.com

PostgreSQL's explain analyze made readable

Result: UD6y

Settings
# exclusive inclusive rows x rows loops node
1. 0.001 109.200 ↑ 1.0 1 1

Unique (cost=9,387.68..9,387.68 rows=1 width=8) (actual time=109.199..109.200 rows=1 loops=1)

2. 0.010 109.199 ↑ 1.0 1 1

Sort (cost=9,387.68..9,387.68 rows=1 width=8) (actual time=109.199..109.199 rows=1 loops=1)

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

Aggregate (cost=9,387.66..9,387.67 rows=1 width=8) (actual time=109.189..109.189 rows=1 loops=1)

4. 16.452 103.073 ↓ 1.3 21,501 1

Merge Join (cost=3,241.34..9,346.96 rows=16,280 width=4) (actual time=42.724..103.073 rows=21,501 loops=1)

  • Merge Cond: (spree_variants.product_id = spree_products_taxons.product_id)
5. 6.787 69.537 ↓ 1.1 6,158 1

Merge Join (cost=3,241.05..8,095.82 rows=5,382 width=16) (actual time=42.706..69.537 rows=6,158 loops=1)

  • Merge Cond: (spree_variants.product_id = spree_product_translations.spree_product_id)
6. 7.155 57.579 ↓ 1.1 6,158 1

Merge Join (cost=3,240.77..6,303.16 rows=5,431 width=12) (actual time=42.687..57.579 rows=6,158 loops=1)

  • Merge Cond: (spree_variants.product_id = spree_products.id)
7. 4.779 44.674 ↓ 1.1 6,674 1

Sort (cost=3,240.48..3,255.67 rows=6,077 width=8) (actual time=42.663..44.674 rows=6,674 loops=1)

  • Sort Key: spree_variants.product_id
  • Sort Method: quicksort Memory: 505kB
8. 6.675 39.895 ↓ 1.1 6,674 1

Hash Join (cost=1,002.20..2,858.57 rows=6,077 width=8) (actual time=18.266..39.895 rows=6,674 loops=1)

  • Hash Cond: (spree_prices.variant_id = spree_variants.id)
9. 15.006 15.006 ↓ 1.0 16,740 1

Seq Scan on spree_prices (cost=0.00..1,733.81 rows=16,477 width=4) (actual time=0.012..15.006 rows=16,740 loops=1)

  • Filter: ((deleted_at IS NULL) AND ((currency)::text = 'BRL'::text))
  • Rows Removed by Filter: 65340
10. 2.240 18.214 ↓ 1.0 6,669 1

Hash (cost=920.80..920.80 rows=6,512 width=12) (actual time=18.214..18.214 rows=6,669 loops=1)

  • Buckets: 8192 Batches: 1 Memory Usage: 351kB
11. 5.725 15.974 ↓ 1.0 6,669 1

Hash Join (cost=295.69..920.80 rows=6,512 width=12) (actual time=4.764..15.974 rows=6,669 loops=1)

  • Hash Cond: (spree_variants.product_id = ps.product_id)
12. 5.530 5.530 ↓ 1.0 12,605 1

Seq Scan on spree_variants (cost=0.00..498.56 rows=12,286 width=8) (actual time=0.005..5.530 rows=12,605 loops=1)

  • Filter: ((is_master IS TRUE) AND (deleted_at IS NULL))
  • Rows Removed by Filter: 5061
13. 2.067 4.719 ↑ 1.0 6,903 1

Hash (cost=209.35..209.35 rows=6,907 width=4) (actual time=4.719..4.719 rows=6,903 loops=1)

  • Buckets: 8192 Batches: 1 Memory Usage: 307kB
14. 2.652 2.652 ↑ 1.0 6,903 1

Seq Scan on spree_products_stores ps (cost=0.00..209.35 rows=6,907 width=4) (actual time=0.011..2.652 rows=6,903 loops=1)

  • Filter: (store_id = 1)
  • Rows Removed by Filter: 4815
15. 5.750 5.750 ↓ 1.0 12,007 1

Index Only Scan using idx_bruno_products_ct_ids on spree_products (cost=0.29..2,952.54 rows=11,616 width=4) (actual time=0.017..5.750 rows=12,007 loops=1)

  • Heap Fetches: 2524
16. 5.171 5.171 ↓ 1.0 12,991 1

Index Only Scan using idx_bruno_product_translations_pt on spree_product_translations (cost=0.29..1,724.12 rows=12,919 width=4) (actual time=0.014..5.171 rows=12,991 loops=1)

  • Heap Fetches: 3861
17. 17.084 17.084 ↓ 1.0 39,386 1

Index Only Scan using index_spree_products_taxons_on_product_id on spree_products_taxons (cost=0.29..1,028.78 rows=38,699 width=4) (actual time=0.015..17.084 rows=39,386 loops=1)

  • Heap Fetches: 25019
Planning time : 2.916 ms
Execution time : 109.372 ms