explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 3RZC : Core: category product count

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 3.528 ↑ 1.0 1 1

Unique (cost=402.36..402.36 rows=1 width=8) (actual time=3.528..3.528 rows=1 loops=1)

2. 0.005 3.528 ↑ 1.0 1 1

Sort (cost=402.36..402.36 rows=1 width=8) (actual time=3.527..3.528 rows=1 loops=1)

  • Sort Key: (count(DISTINCT product_groups.id))
  • Sort Method: quicksort Memory: 25kB
3. 0.685 3.523 ↑ 1.0 1 1

Aggregate (cost=402.34..402.35 rows=1 width=8) (actual time=3.522..3.523 rows=1 loops=1)

4. 0.839 2.838 ↑ 1.4 4,701 1

Hash Left Join (cost=45.29..385.39 rows=6,779 width=4) (actual time=0.530..2.838 rows=4,701 loops=1)

  • Hash Cond: (skus.id = sku_variations_skus_join.sku_id)
5. 0.197 1.564 ↑ 1.3 1,567 1

Nested Loop Left Join (cost=6.12..322.49 rows=2,034 width=8) (actual time=0.071..1.564 rows=1,567 loops=1)

6. 0.006 0.112 ↑ 1.2 5 1

Nested Loop Left Join (cost=5.68..105.38 rows=6 width=12) (actual time=0.058..0.112 rows=5 loops=1)

7. 0.005 0.081 ↑ 1.2 5 1

Nested Loop Left Join (cost=5.54..104.34 rows=6 width=12) (actual time=0.037..0.081 rows=5 loops=1)

8. 0.004 0.066 ↑ 1.2 5 1

Nested Loop Left Join (cost=5.25..101.86 rows=6 width=12) (actual time=0.032..0.066 rows=5 loops=1)

9. 0.005 0.052 ↑ 1.2 5 1

Nested Loop Left Join (cost=4.97..99.74 rows=6 width=12) (actual time=0.028..0.052 rows=5 loops=1)

10. 0.005 0.037 ↑ 1.2 5 1

Nested Loop Left Join (cost=4.68..97.53 rows=6 width=8) (actual time=0.024..0.037 rows=5 loops=1)

11. 0.012 0.020 ↑ 3.0 2 1

Bitmap Heap Scan on product_groups (cost=4.40..47.66 rows=6 width=4) (actual time=0.016..0.020 rows=2 loops=1)

  • Recheck Cond: (category_id = 26)
  • Filter: active
  • Rows Removed by Filter: 3
  • Heap Blocks: exact=4
12. 0.008 0.008 ↑ 3.0 5 1

Bitmap Index Scan on index_product_groups_on_category_id (cost=0.00..4.40 rows=15 width=0) (actual time=0.008..0.008 rows=5 loops=1)

  • Index Cond: (category_id = 26)
13. 0.012 0.012 ↓ 2.0 2 2

Index Scan using index_groupables_on_product_group_id on groupables (cost=0.29..8.30 rows=1 width=8) (actual time=0.005..0.006 rows=2 loops=2)

  • Index Cond: (product_group_id = product_groups.id)
14. 0.010 0.010 ↑ 1.0 1 5

Index Scan using products_pkey on products (cost=0.29..0.37 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=5)

  • Index Cond: (id = groupables.product_id)
15. 0.010 0.010 ↑ 1.0 1 5

Index Scan using index_groupables_on_product_id on groupables groupables_products_join (cost=0.29..0.34 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=5)

  • Index Cond: (product_id = products.id)
16. 0.010 0.010 ↑ 1.0 1 5

Index Scan using skus_pkey on skus (cost=0.29..0.41 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=5)

  • Index Cond: (id = products.sku_id)
17. 0.025 0.025 ↑ 1.0 1 5

Index Only Scan using index_sku_variations_on_sku_id_and_option_type_id on sku_variations (cost=0.14..0.16 rows=1 width=4) (actual time=0.005..0.005 rows=1 loops=5)

  • Index Cond: (sku_id = skus.id)
  • Heap Fetches: 5
18. 1.255 1.255 ↑ 2.1 313 5

Index Only Scan using index_discounts_on_product_id on discounts (cost=0.43..29.62 rows=657 width=4) (actual time=0.004..0.251 rows=313 loops=5)

  • Index Cond: (product_id = products.id)
  • Heap Fetches: 1,564
19. 0.096 0.435 ↑ 1.0 593 1

Hash (cost=31.76..31.76 rows=593 width=4) (actual time=0.435..0.435 rows=593 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 29kB
20. 0.141 0.339 ↑ 1.0 593 1

Hash Right Join (cost=12.68..31.76 rows=593 width=4) (actual time=0.151..0.339 rows=593 loops=1)

  • Hash Cond: (option_values.option_type_id = option_types.id)
21. 0.060 0.060 ↑ 1.0 593 1

Seq Scan on option_values (cost=0.00..10.93 rows=593 width=4) (actual time=0.006..0.060 rows=593 loops=1)

22. 0.028 0.138 ↑ 1.0 182 1

Hash (cost=10.40..10.40 rows=182 width=8) (actual time=0.138..0.138 rows=182 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 16kB
23. 0.042 0.110 ↑ 1.0 182 1

Hash Left Join (cost=6.10..10.40 rows=182 width=8) (actual time=0.061..0.110 rows=182 loops=1)

  • Hash Cond: (sku_variations_skus_join.option_type_id = option_types.id)
24. 0.021 0.021 ↑ 1.0 182 1

Seq Scan on sku_variations sku_variations_skus_join (cost=0.00..3.82 rows=182 width=8) (actual time=0.009..0.021 rows=182 loops=1)

25. 0.028 0.047 ↑ 1.0 182 1

Hash (cost=3.82..3.82 rows=182 width=4) (actual time=0.047..0.047 rows=182 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 15kB
26. 0.019 0.019 ↑ 1.0 182 1

Seq Scan on option_types (cost=0.00..3.82 rows=182 width=4) (actual time=0.003..0.019 rows=182 loops=1)

Planning time : 1.181 ms
Execution time : 4.239 ms