Fix ambiguous column reference in backfill DB stats query
This commit is contained in:
parent
faa23a9693
commit
1c2879c466
1 changed files with 5 additions and 5 deletions
|
|
@ -160,17 +160,17 @@ defmodule MicrowavepropWeb.BackfillLive do
|
||||||
%{rows: rows} =
|
%{rows: rows} =
|
||||||
Repo.query!("""
|
Repo.query!("""
|
||||||
SELECT
|
SELECT
|
||||||
relname as table,
|
c.relname as table,
|
||||||
n_live_tup as rows,
|
s.n_live_tup as rows,
|
||||||
pg_total_relation_size(c.oid) as bytes
|
pg_total_relation_size(c.oid) as bytes
|
||||||
FROM pg_class c
|
FROM pg_class c
|
||||||
JOIN pg_namespace n ON n.oid = c.relnamespace
|
JOIN pg_namespace n ON n.oid = c.relnamespace
|
||||||
JOIN pg_stat_user_tables s ON s.relid = c.oid
|
JOIN pg_stat_user_tables s ON s.relid = c.oid
|
||||||
WHERE n.nspname = 'public'
|
WHERE n.nspname = 'public'
|
||||||
AND c.relkind = 'r'
|
AND c.relkind = 'r'
|
||||||
AND relname NOT LIKE 'oban_%'
|
AND c.relname NOT LIKE 'oban_%'
|
||||||
AND relname NOT LIKE 'schema_%'
|
AND c.relname NOT LIKE 'schema_%'
|
||||||
AND n_live_tup > 0
|
AND s.n_live_tup > 0
|
||||||
ORDER BY pg_total_relation_size(c.oid) DESC
|
ORDER BY pg_total_relation_size(c.oid) DESC
|
||||||
LIMIT 20
|
LIMIT 20
|
||||||
""")
|
""")
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue