explain.depesz.com

PostgreSQL's explain analyze made readable

Result: LrK8

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

Unique (cost=6,628.14..6,628.14 rows=1 width=8) (actual time=72.017..72.018 rows=1 loops=1)

2. 0.006 72.017 ↑ 1.0 1 1

Sort (cost=6,628.14..6,628.14 rows=1 width=8) (actual time=72.016..72.017 rows=1 loops=1)

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

Aggregate (cost=6,628.12..6,628.13 rows=1 width=8) (actual time=72.010..72.011 rows=1 loops=1)

4. 6.289 66.506 ↓ 1.7 14,025 1

Nested Loop (cost=1,930.16..6,607.52 rows=8,238 width=4) (actual time=10.984..66.506 rows=14,025 loops=1)

5. 3.380 45.581 ↓ 1.3 3,659 1

Nested Loop (cost=1,929.87..5,491.31 rows=2,730 width=16) (actual time=10.975..45.581 rows=3,659 loops=1)

6. 2.355 34.883 ↓ 1.3 3,659 1

Nested Loop (cost=1,929.59..4,198.57 rows=2,762 width=12) (actual time=10.967..34.883 rows=3,659 loops=1)

7. 5.327 21.551 ↓ 1.3 3,659 1

Hash Join (cost=1,929.29..2,503.85 rows=2,904 width=16) (actual time=10.956..21.551 rows=3,659 loops=1)

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

Seq Scan on spree_variants (cost=0.00..498.94 rows=12,318 width=8) (actual time=0.006..5.288 rows=12,632 loops=1)

  • Filter: ((is_master IS TRUE) AND (deleted_at IS NULL))
  • Rows Removed by Filter: 5062
9. 1.239 10.936 ↓ 1.2 3,659 1

Hash (cost=1,890.39..1,890.39 rows=3,112 width=8) (actual time=10.936..10.936 rows=3,659 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 175kB
10. 2.789 9.697 ↓ 1.2 3,659 1

Hash Join (cost=290.62..1,890.39 rows=3,112 width=8) (actual time=4.330..9.697 rows=3,659 loops=1)

  • Hash Cond: (spree_products.id = ps.product_id)
11. 2.600 2.600 ↑ 1.0 5,881 1

Index Only Scan using id_bruno_products_list on spree_products (cost=0.41..1,539.01 rows=6,010 width=4) (actual time=0.008..2.600 rows=5,881 loops=1)

  • Index Cond: (available_on <= '2019-11-26 00:00:00'::timestamp without time zone)
  • Heap Fetches: 958
12. 1.849 4.308 ↑ 1.0 6,675 1

Hash (cost=206.72..206.72 rows=6,679 width=4) (actual time=4.308..4.308 rows=6,675 loops=1)

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

Seq Scan on spree_products_stores ps (cost=0.00..206.72 rows=6,679 width=4) (actual time=0.006..2.459 rows=6,675 loops=1)

  • Filter: (store_id = 1)
  • Rows Removed by Filter: 4823
14. 10.977 10.977 ↑ 1.0 1 3,659

Index Only Scan using idx_bruno_variant_price_spree on spree_prices (cost=0.29..0.57 rows=1 width=4) (actual time=0.002..0.003 rows=1 loops=3,659)

  • Index Cond: ((variant_id = spree_variants.id) AND (currency = 'BRL'::text))
  • Heap Fetches: 3591
15. 7.318 7.318 ↑ 1.0 1 3,659

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=3,659)

  • Index Cond: (spree_product_id = spree_variants.product_id)
  • Heap Fetches: 1234
16. 14.636 14.636 ↓ 1.3 4 3,659

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=3,659)

  • Index Cond: (product_id = spree_variants.product_id)
  • Heap Fetches: 10202
Planning time : 2.989 ms
Execution time : 72.102 ms