Skip to content

Commit 421d7fd

Browse files
author
Dementii Priadko
committed
Checkup20
1 parent 78f675e commit 421d7fd

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,22 +48,22 @@ grant select on pg_stat_database to postgres_ai_mon;
4848
grant select on pg_stat_user_tables to postgres_ai_mon;
4949

5050
-- Create a public view for pg_statistic access (required for bloat metrics on user schemas)
51-
CREATE VIEW public.pg_statistic AS
52-
SELECT
51+
create view public.pg_statistic as
52+
select
5353
n.nspname as schemaname,
5454
c.relname as tablename,
5555
a.attname,
5656
s.stanullfrac as null_frac,
5757
s.stawidth as avg_width,
5858
false as inherited
59-
FROM pg_statistic s
60-
JOIN pg_class c ON c.oid = s.starelid
61-
JOIN pg_namespace n ON n.oid = c.relnamespace
62-
JOIN pg_attribute a ON a.attrelid = s.starelid AND a.attnum = s.staattnum
63-
WHERE a.attnum > 0 AND NOT a.attisdropped;
64-
65-
GRANT SELECT ON public.pg_statistic TO pg_monitor;
66-
ALTER USER postgres_ai_mon set search_path = "$user", public, pg_catalog;
59+
from pg_statistic s
60+
join pg_class c on c.oid = s.starelid
61+
join pg_namespace n on n.oid = c.relnamespace
62+
join pg_attribute a on a.attrelid = s.starelid and a.attnum = s.staattnum
63+
where a.attnum > 0 and not a.attisdropped;
64+
65+
grant select on public.pg_statistic to pg_monitor;
66+
alter user postgres_ai_mon set search_path = "$user", public, pg_catalog;
6767
```
6868

6969
**One command setup:**

0 commit comments

Comments
 (0)