explain.depesz.com

PostgreSQL's explain analyze made readable

Result: FTc5

Settings
# exclusive inclusive rows x rows loops node
1. 0.003 67.667 ↑ 1.0 1 1

Unique (cost=8,432.44..8,432.45 rows=1 width=8) (actual time=67.666..67.667 rows=1 loops=1)

2. 0.006 67.664 ↑ 1.0 1 1

Sort (cost=8,432.44..8,432.44 rows=1 width=8) (actual time=67.664..67.664 rows=1 loops=1)

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

Aggregate (cost=8,432.42..8,432.43 rows=1 width=8) (actual time=67.658..67.658 rows=1 loops=1)

4. 5.310 63.033 ↓ 2.0 11,694 1

Nested Loop (cost=5,266.93..8,417.45 rows=5,988 width=4) (actual time=19.647..63.033 rows=11,694 loops=1)

5. 2.159 46.795 ↓ 1.4 2,732 1

Nested Loop (cost=5,266.64..7,608.07 rows=1,979 width=16) (actual time=19.637..46.795 rows=2,732 loops=1)

6. 1.463 39.172 ↓ 1.4 2,732 1

Nested Loop (cost=5,266.36..6,672.86 rows=1,996 width=12) (actual time=19.612..39.172 rows=2,732 loops=1)

7. 4.497 29.513 ↓ 1.3 2,732 1

Hash Join (cost=5,266.07..5,832.22 rows=2,138 width=16) (actual time=19.598..29.513 rows=2,732 loops=1)

  • Hash Cond: (spree_variants.product_id = spree_products.id)
8. 5.441 5.441 ↓ 1.0 12,595 1

Seq Scan on spree_variants (cost=0.00..498.46 rows=12,279 width=8) (actual time=0.007..5.441 rows=12,595 loops=1)

  • Filter: ((is_master IS TRUE) AND (deleted_at IS NULL))
  • Rows Removed by Filter: 5061
9. 1.025 19.575 ↓ 1.2 2,732 1

Hash (cost=5,237.43..5,237.43 rows=2,291 width=8) (actual time=19.575..19.575 rows=2,732 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 139kB
10. 2.345 18.550 ↓ 1.2 2,732 1

Hash Join (cost=295.69..5,237.43 rows=2,291 width=8) (actual time=4.610..18.550 rows=2,732 loops=1)

  • Hash Cond: (spree_products.id = ps.product_id)
11. 11.620 11.620 ↓ 1.2 5,132 1

Seq Scan on spree_products (cost=0.00..4,897.51 rows=4,265 width=4) (actual time=0.010..11.620 rows=5,132 loops=1)

  • Filter: ((deleted_at IS 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: 7727
12. 1.924 4.585 ↑ 1.0 6,893 1

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

  • Buckets: 8192 Batches: 1 Memory Usage: 307kB
13. 2.661 2.661 ↑ 1.0 6,893 1

Seq Scan on spree_products_stores ps (cost=0.00..209.35 rows=6,907 width=4) (actual time=0.006..2.661 rows=6,893 loops=1)

  • Filter: (store_id = 1)
  • Rows Removed by Filter: 4815
14. 8.196 8.196 ↑ 1.0 1 2,732

Index Only Scan using idx_bruno_variant_price_spree on spree_prices (cost=0.29..0.38 rows=1 width=4) (actual time=0.002..0.003 rows=1 loops=2,732)

  • Index Cond: ((variant_id = spree_variants.id) AND (currency = 'BRL'::text))
  • Heap Fetches: 2301
15. 5.464 5.464 ↑ 1.0 1 2,732

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.002..0.002 rows=1 loops=2,732)

  • Index Cond: (spree_product_id = spree_variants.product_id)
  • Heap Fetches: 669
16. 10.928 10.928 ↓ 1.3 4 2,732

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.002..0.004 rows=4 loops=2,732)

  • Index Cond: (product_id = spree_variants.product_id)
  • Heap Fetches: 8082
Planning time : 3.126 ms
Execution time : 67.765 ms