pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Analyze Table
3+ messages / 2 participants
[nested] [flat]

* Analyze Table
@ 2017-08-18 16:50  anand086 <anand086@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: anand086 @ 2017-08-18 16:50 UTC (permalink / raw)
  To: pgsql-admin

Hello All,


We have a requirement wherein, analyze table needs to be called from within
the application.

To give a background, we have schema called "dev" under which all the tables
are created, then we have "dev_dba" user which has been granted ownership of
all tables and then we have "dev_user" (application user) accessing the data
from the java application.

The application code run as dev_user, needs to analyze the table in case
application does truncate and insert data (~ 10 millions rows). 

As per my understanding, only the owner of the table can analyze the table
and we do not want to make "dev_user" the owner. 

What is the best possible way to get the table analyzed from application
code without changing granting owner to dev_user? 


Thank you for your time.


Regards,
Anand



--
View this message in context: http://www.postgresql-archive.org/Analyze-Table-tp5979024.html
Sent from the PostgreSQL - admin mailing list archive at Nabble.com.


-- 
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Analyze Table
@ 2017-08-18 16:59  David G. Johnston <david.g.johnston@gmail.com>
  parent: anand086 <anand086@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: David G. Johnston @ 2017-08-18 16:59 UTC (permalink / raw)
  To: anand086 <anand086@gmail.com>; +Cc: pgsql-admin

On Fri, Aug 18, 2017 at 9:50 AM, anand086 <anand086@gmail.com> wrote:

> What is the best possible way to get the table analyzed from application
> code without changing granting owner to dev_user?
>

​A solution is to write a "SECURITY DEFINER" function.​

David J.

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Analyze Table
@ 2017-08-18 17:13  anand086 <anand086@gmail.com>
  parent: David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: anand086 @ 2017-08-18 17:13 UTC (permalink / raw)
  To: pgsql-admin

Thank you for your quick update. 

SECURITY DEFINER resolved the issue :)

Regards,
Anand



--
View this message in context: http://www.postgresql-archive.org/Analyze-Table-tp5979024p5979032.html
Sent from the PostgreSQL - admin mailing list archive at Nabble.com.


-- 
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2017-08-18 17:13 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-08-18 16:50 Analyze Table anand086 <anand086@gmail.com>
2017-08-18 16:59 ` David G. Johnston <david.g.johnston@gmail.com>
2017-08-18 17:13   ` anand086 <anand086@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox