explain.depesz.com

PostgreSQL's explain analyze made readable

Result: kXWjz

Settings
# exclusive inclusive rows x rows loops node
1. 0.007 71,726.171 ↓ 7.0 7 1

Unique (cost=110,359.55..110,359.56 rows=1 width=132) (actual time=71,726.165..71,726.171 rows=7 loops=1)

2.          

CTE f

3. 0.002 0.002 ↑ 1.0 1 1

Result (cost=0.00..0.01 rows=1 width=32) (actual time=0.002..0.002 rows=1 loops=1)

4. 0.057 71,726.164 ↓ 13.0 13 1

Sort (cost=110,359.54..110,359.54 rows=1 width=132) (actual time=71,726.163..71,726.164 rows=13 loops=1)

  • Sort Key: ((m.date_key)::text) DESC, sk.option_key
  • Sort Method: quicksort Memory: 26kB
5. 0.164 71,726.107 ↓ 13.0 13 1

Nested Loop (cost=1.84..110,359.53 rows=1 width=132) (actual time=52.462..71,726.107 rows=13 loops=1)

  • Join Filter: (sk.sku_key = sc.sku_key)
6. 1.346 71,504.659 ↓ 14.0 14 1

Nested Loop Left Join (cost=1.42..106,694.87 rows=1 width=365) (actual time=32.480..71,504.659 rows=14 loops=1)

  • Join Filter: (sso.org_key = m.org_key)
  • Filter: (sso.settings IS NULL)
  • Rows Removed by Filter: 1,471
7. 0.766 71,482.328 ↑ 1.2 1,399 1

Nested Loop (cost=1.14..106,141.21 rows=1,653 width=365) (actual time=1.169..71,482.328 rows=1,399 loops=1)

  • Join Filter: CASE WHEN (array_length(f.groups, 1) IS NULL) THEN true ELSE (sk.group_key = ANY (f.groups)) END
8. 0.004 0.004 ↑ 1.0 1 1

CTE Scan on f (cost=0.00..0.02 rows=1 width=32) (actual time=0.003..0.004 rows=1 loops=1)

9. 0.955 71,481.558 ↑ 2.4 1,399 1

Nested Loop (cost=1.14..106,058.54 rows=3,306 width=367) (actual time=1.163..71,481.558 rows=1,399 loops=1)

10. 0.428 71,016.178 ↑ 2.3 1,429 1

Nested Loop (cost=0.72..104,300.05 rows=3,306 width=12) (actual time=1.151..71,016.178 rows=1,429 loops=1)

11. 0.018 0.018 ↑ 1.0 1 1

Index Scan using mutations_names_pkey on mutations_names n (cost=0.15..24.27 rows=1 width=4) (actual time=0.010..0.018 rows=1 loops=1)

  • Index Cond: (org_key = 1)
  • Filter: (description = 'inbounds'::text)
  • Rows Removed by Filter: 30
12. 71,015.732 71,015.732 ↑ 35.6 1,429 1

Index Scan using mutations_org_date_mutation_idx on mutations m (cost=0.57..103,767.11 rows=50,867 width=14) (actual time=1.137..71,015.732 rows=1,429 loops=1)

  • Index Cond: ((org_key = 1) AND (date_key > (now() - '31 days'::interval)) AND (mutation_key = n.mutation_key))
13. 464.425 464.425 ↑ 1.0 1 1,429

Index Scan using skus_pkey on skus sk (cost=0.42..0.53 rows=1 width=359) (actual time=0.325..0.325 rows=1 loops=1,429)

  • Index Cond: ((org_key = 1) AND (sku_key = m.sku_key))
  • Filter: stock_active
14. 20.985 20.985 ↑ 1.0 1 1,399

Index Scan using stock_settings_options_pkey on stock_settings_options sso (cost=0.28..0.32 rows=1 width=333) (actual time=0.015..0.015 rows=1 loops=1,399)

  • Index Cond: ((org_key = 1) AND (sk.option_key = option_key))
15. 221.284 221.284 ↑ 2.0 1 14

Index Scan using stock_current_pkey on stock_current sc (cost=0.42..3,664.61 rows=2 width=8) (actual time=9.474..15.806 rows=1 loops=14)

  • Index Cond: ((org_key = 1) AND (sku_key = m.sku_key))
  • Filter: ((economical <= 0) AND (store_key <> m.store_key))
  • Rows Removed by Filter: 51