- Notifications
You must be signed in to change notification settings - Fork5.2k
Commit6b34e21
committed
Document privileges required for vacuumdb --missing-stats-only.
When vacuumdb's --missing-stats-only option is used, the catalogquery for retrieving the list of relations to process must readpg_statistic and pg_statistic_ext_data. However, those catalogscan only be read by superusers by default, so --missing-stats-onlyis effectively superuser-only. This is unfortunate, but since theoption is primarily intended for use by administrators afterrunning pg_upgrade, let's just live with it for v18. This commitadds a note about the aforementioned privilege requirements to thedocumentation for --missing-stats-only.We first tried to improve matters by modifying the query to readthe pg_stats and pg_stats_ext system views instead. While that isindeed more lenient from a privilege standpoint, it is alsoborderline incomprehensible. pg_stats shows rows for which theuser has the SELECT privilege on the corresponding column, andpg_stats_ext shows rows for tables the user owns. Meanwhile,ANALYZE requires either MAINTAIN on the table or, for non-sharedrelations, ownership of the database. But even if the privilegediscrepancies were tolerable, the performance impact was not.Ultimately, the modified query was substantially more expensive, sowe abandoned the idea.For v19, perhaps we could introduce a simple, inexpensive way todiscover which relations are missing statistics, such as a systemfunction or view with similar privilege requirements to ANALYZE.Unfortunately, it is far too late for anything like that in v18.Reviewed-by: Yugo Nagata <nagata@sraoss.co.jp>Reviewed-by: Fujii Masao <masao.fujii@gmail.com>Discussion:https://postgr.es/m/CAHGQGwHh43suEfss1wvBsk7vqiou%3DUY0zcy8HGyE5hBp%2BHZ7SQ%40mail.gmail.comBackpatch-through: 181 parent3a7a3ea commit6b34e21
1 file changed
+8
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
292 | 292 | | |
293 | 293 | | |
294 | 294 | | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
295 | 303 | | |
296 | 304 | | |
297 | 305 | | |
| |||
0 commit comments
Comments
(0)