Re: Only owners can ANALYZE tables...seems overly restrictive
От
David G. Johnston
Тема
Re: Only owners can ANALYZE tables...seems overly restrictive
Дата
Msg-id
CAKFQuwafN63Nyo9=SzDC0GOndFi6yY_V9XXbXz=VogbvL0meUQ@mail.gmail.com
Ответ на
Re: Only owners can ANALYZE tables...seems overly
restrictive (Adrian Klaver)
Список
Дерево обсуждения
Only owners can ANALYZE tables...seems overly restrictive "David G. Johnston" <david.g.johnston@gmail.com>
Re: Only owners can ANALYZE tables...seems overly
restrictive Stephen Frost <sfrost@snowman.net>
Re: Only owners can ANALYZE tables...seems overly
restrictive "Joshua D. Drake" <jd@commandprompt.com>
Re: Only owners can ANALYZE tables...seems overly
restrictive Alvaro Herrera <alvherre@2ndquadrant.com>
Re: Only owners can ANALYZE tables...seems overly
restrictive "Joshua D. Drake" <jd@commandprompt.com>
Re: Only owners can ANALYZE tables...seems overly restrictive Guillaume Lelarge <guillaume@lelarge.info>
Re: Only owners can ANALYZE tables...seems overly
restrictive Vik Fearing <vik@2ndquadrant.fr>
Re: Only owners can ANALYZE tables...seems overly
restrictive Bosco Rama <postgres@boscorama.com>
Re: Only owners can ANALYZE tables...seems overly restrictive Guillaume Lelarge <guillaume@lelarge.info>
Re: Only owners can ANALYZE tables...seems overly restrictive "David G. Johnston" <david.g.johnston@gmail.com>
Re: Only owners can ANALYZE tables...seems overly
restrictive Stephen Frost <sfrost@snowman.net>
Re: Only owners can ANALYZE tables...seems overly restrictive "David G. Johnston" <david.g.johnston@gmail.com>
Re: Only owners can ANALYZE tables...seems overly
restrictive Adrian Klaver <adrian.klaver@aklaver.com>
Re: Only owners can ANALYZE tables...seems overly restrictive "David G. Johnston" <david.g.johnston@gmail.com>
Re: Only owners can ANALYZE tables...seems overly restrictive Tom Lane <tgl@sss.pgh.pa.us>
Re: Only owners can ANALYZE tables...seems overly
restrictive John R Pierce <pierce@hogranch.com>
Re: Only owners can ANALYZE tables...seems overly
restrictive Albe Laurenz <laurenz.albe@wien.gv.at>
Re: Only owners can ANALYZE tables...seems overly restrictive "David G. Johnston" <david.g.johnston@gmail.com>
Re: Only owners can ANALYZE tables...seems overly
restrictive Albe Laurenz <laurenz.albe@wien.gv.at>
Re: Only owners can ANALYZE tables...seems overly restrictive "David G. Johnston" <david.g.johnston@gmail.com>
Re: Only owners can ANALYZE tables...seems overly
restrictive Albe Laurenz <laurenz.albe@wien.gv.at>
Re: Only owners can ANALYZE tables...seems overly restrictive "David G. Johnston" <david.g.johnston@gmail.com>
Re: Only owners can ANALYZE tables...seems overly restrictive Tom Lane <tgl@sss.pgh.pa.us>
Re: Only owners can ANALYZE tables...seems overly restrictive "David G. Johnston" <david.g.johnston@gmail.com>
Re: Only owners can ANALYZE tables...seems overly restrictive "David G. Johnston" <david.g.johnston@gmail.com>
Re: Only owners can ANALYZE tables...seems overly
restrictive "Joshua D. Drake" <jd@commandprompt.com>
Re: Only owners can ANALYZE tables...seems overly restrictive "David G. Johnston" <david.g.johnston@gmail.com>
Re: Only owners can ANALYZE tables...seems overly restrictive "David G. Johnston" <david.g.johnston@gmail.com>
Re: Only owners can ANALYZE tables...seems overly
restrictive Stephen Frost <sfrost@snowman.net>
Re: Only owners can ANALYZE tables...seems overly restrictive "David G. Johnston" <david.g.johnston@gmail.com>
Re: Only owners can ANALYZE tables...seems overly
restrictive Stephen Frost <sfrost@snowman.net>
Re: Only owners can ANALYZE tables...seems overly restrictive Vitaly Burovoy <vitaly.burovoy@gmail.com>
Re: Only owners can ANALYZE tables...seems overly restrictive "David G. Johnston" <david.g.johnston@gmail.com>
So the typical user doesn't know or even care that what they just did
needs to be analyzed. The situation is no worse than it is today. But
as someone who writes many scripts and applications to perform bulk
writing and data analysis I'd like those scripts to use restricted
authorization credentials while still being able to run ANALYZE between
performing the bulk DML and the running the SELECT statements needed to
get the newly generated data out of the database.
Maybe?:
CREATE OR REPLACE FUNCTION public.analyze_test(tbl_name character varying)
RETURNS void
LANGUAGE plpgsql
SECURITY DEFINER
AS $function$
BEGIN
EXECUTE 'ANALYZE ' || quote_ident(tbl_name);
END;
$function$
Yes, a security definer function - and setting execute permissions appropriately - would work. But it is a hack to work around a restriction that, in theory, need not exist. I understand that our implementation - namely the presence of a publically visible GUC and uninhibitied SET usage
- may make reality more complicated than this.
I guess I don't see why anyone other than the database owner and superuser (if that, it probably could be made to be fixed at startup) should be allowed to SET default_statistics_target. If a table owner wants to play with different levels they can always just ALTER TABLE SET - which has the benefit (though maybe this is undesirable in some instances...) of making the alteration effective during auto-vacuum runs.
ANALYZE is something that needs to happen frequently and commonly on a running system for proper operation. In comparison the statistic targets are basically frozen values aside from periods of experimentation. We have our priorities backwards if SET is preventing more user-friendly usage of ANALYZE.
David J.
В списке pgsql-general по дате отправления
От: David G. Johnston
Дата: