Re: Only owners can ANALYZE tables...seems overly restrictive

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
Cc: "John R Pierce *EXTERN*" <pierce(at)hogranch(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Only owners can ANALYZE tables...seems overly restrictive
Date: 2016-02-29 17:09:40
Message-ID: CAKFQuwaGsNPj6vOzOaCWGz=6Lr0652jp_im76jidZzHONTd_KA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Feb 29, 2016 at 9:27 AM, Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
wrote:

> David G. Johnston wrote:
> >>>> In a production environment you don't want a user to change your table
> >>>> statistics.
> >>>>
> >>>> They could just set default_statistics_target to something stupid,
> >>>> run ANALYZE and wreck the statistics for everyone.
> >>>> And then come back to the DBA and complain that things don't work.
>
> >>> ​Setting default_statistics_target and running ANALYZE are two
> entirely different things.
>
> >> Setting default_statistics_target affects the statistics computed by
> ANALYZE,
> >> so I cannot follow you here.
>
> > ​Just because I can run ANALYZE doesn't mean I should be able to update
> the statistic targets. While
> > the features are related the permissions are not.
>
> See http://stream.boxwatch.ru/docs/current/static/planner-stats.html
>
> "The amount of information stored in pg_statistic by ANALYZE, in
> particular the
> maximum number of entries in the most_common_vals and histogram_bounds
> arrays
> for each column, can be set on a column-by-column basis using the
> ALTER TABLE SET STATISTICS command, or globally by setting the
> default_statistics_target configuration variable."
>

​
Being able to run ANALYZE on a table in no way implies that ​I should be
allowed to run ALTER TABLE SET STATISTICS on the same.
​

Only table owners should be allowed to execute ALTER TABLE while, in my
opinion, anyone with write capabilities on a table should be allowed to
execute ANALYZE.​ I would accept a GRANT permission if that could get
committed but I find the status-quo mildly annoying.

David J.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bosco Rama 2016-02-29 17:27:43 Re: Only owners can ANALYZE tables...seems overly restrictive
Previous Message Joshua D. Drake 2016-02-29 16:58:24 Re: Only owners can ANALYZE tables...seems overly restrictive