Skip to content

Commit af412d0

Browse files
Merge remote-tracking branch 'origin/main' into improve-unused-indexes-report
2 parents f8ebe79 + 0894079 commit af412d0

File tree

5 files changed

+1141
-32
lines changed

5 files changed

+1141
-32
lines changed

README.md

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,9 @@ create user postgres_ai_mon with password '<password>';
9595
grant connect on database <database_name> to postgres_ai_mon;
9696

9797
grant pg_monitor to postgres_ai_mon;
98-
grant select on pg_stat_statements to postgres_ai_mon;
99-
grant select on pg_stat_database to postgres_ai_mon;
100-
grant select on pg_stat_user_tables to postgres_ai_mon;
101-
grant select on pg_stat_user_indexes to postgres_ai_mon;
10298
grant select on pg_index to postgres_ai_mon;
10399

104-
-- Create a public view for pg_statistic access (required for bloat metrics on user schemas)
100+
-- Create a public view for pg_statistic access (optional, for bloat analysis)
105101
create view public.pg_statistic as
106102
select
107103
n.nspname as schemaname,
@@ -116,11 +112,29 @@ join pg_namespace n on n.oid = c.relnamespace
116112
join pg_attribute a on a.attrelid = s.starelid and a.attnum = s.staattnum
117113
where a.attnum > 0 and not a.attisdropped;
118114

119-
grant select on public.pg_statistic to pg_monitor;
115+
grant select on public.pg_statistic to postgres_ai_mon;
120116
alter user postgres_ai_mon set search_path = "$user", public, pg_catalog;
121117
commit;
122118
```
123119

120+
### Optional permissions to analyze risks of certain performance cliffs
121+
122+
For RDS Postgres and Aurora:
123+
124+
```sql
125+
create extension if not exists rds_tools;
126+
grant execute on function rds_tools.pg_ls_multixactdir() to postgres_ai_mon;
127+
```
128+
129+
For self-managed Postgres:
130+
131+
```sql
132+
grant execute on function pg_stat_file(text) to postgres_ai_mon;
133+
grant execute on function pg_stat_file(text, boolean) to postgres_ai_mon;
134+
grant execute on function pg_ls_dir(text) to postgres_ai_mon;
135+
grant execute on function pg_ls_dir(text, boolean, boolean) to postgres_ai_mon;
136+
```
137+
124138
**One command setup:**
125139

126140
```bash

0 commit comments

Comments
 (0)