explain.depesz.com

PostgreSQL's explain analyze made readable

Result: EbT4b

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

Unique (cost=8,432.00..8,432.01 rows=1 width=8) (actual time=76.832..76.834 rows=1 loops=1)

2. 0.024 76.831 ↑ 1.0 1 1

Sort (cost=8,432.00..8,432.01 rows=1 width=8) (actual time=76.830..76.831 rows=1 loops=1)

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

Aggregate (cost=8,431.98..8,431.99 rows=1 width=8) (actual time=76.806..76.807 rows=1 loops=1)

4. 6.747 72.100 ↓ 2.0 11,694 1

Nested Loop (cost=5,267.28..8,417.04 rows=5,978 width=4) (actual time=23.459..72.100 rows=11,694 loops=1)

5. 3.250 54.425 ↓ 1.4 2,732 1

Nested Loop (cost=5,266.99..7,608.52 rows=1,977 width=16) (actual time=23.423..54.425 rows=2,732 loops=1)

6. 3.564 45.711 ↓ 1.4 2,732 1

Nested Loop (cost=5,266.71..6,673.96 rows=1,995 width=12) (actual time=23.370..45.711 rows=2,732 loops=1)

7. 4.890 33.951 ↓ 1.3 2,732 1

Hash Join (cost=5,266.42..5,832.71 rows=2,138 width=16) (actual time=23.316..33.951 rows=2,732 loops=1)

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

Seq Scan on spree_variants (cost=0.00..498.56 rows=12,286 width=8) (actual time=0.012..5.785 rows=12,603 loops=1)

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

Hash (cost=5,237.78..5,237.78 rows=2,291 width=8) (actual time=23.275..23.276 rows=2,732 loops=1)

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

Hash Join (cost=295.69..5,237.78 rows=2,291 width=8) (actual time=4.816..22.368 rows=2,732 loops=1)

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

Seq Scan on spree_products (cost=0.00..4,897.85 rows=4,267 width=4) (actual time=0.015..15.030 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: 7735
12. 2.016 4.758 ↑ 1.0 6,901 1

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

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

Seq Scan on spree_products_stores ps (cost=0.00..209.35 rows=6,907 width=4) (actual time=0.011..2.742 rows=6,901 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.003..0.003 rows=1 loops=2,732)

  • Index Cond: ((variant_id = spree_variants.id) AND (currency = 'BRL'::text))
  • Heap Fetches: 2619
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: 688
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 : 5.493 ms
Execution time : 76.975 ms