From: | Kieren Scott <kierenscott(at)hotmail(dot)com> |
---|---|
To: | <greg(at)2ndquadrant(dot)com> |
Cc: | <pgsql-admin(at)postgresql(dot)org> |
Subject: | Re: Restricting schema sizes |
Date: | 2010-10-20 16:22:31 |
Message-ID: | BAY149-w576121FBC100CCF74D469CAE5C0@phx.gbl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
Many thanks.
Is it possbile to set statement_timeout at the user-level in 8.2? e.g. by "alter role myuser set statement_timeout=123456;"
Where can I find out what level statement_timeout can be set at e.g. session, user, database..?
Kieren
Date: Sun, 17 Oct 2010 15:45:16 -0400
From: greg(at)2ndquadrant(dot)com
To: kierenscott(at)hotmail(dot)com
CC: pgsql-admin(at)postgresql(dot)org
Subject: Re: [ADMIN] Restricting schema sizes
Kieren Scott wrote:
What
is the best way to restrict/limit the size that a schema can grow too
in Postgresql?
...
The other option I can think of is writing a script that monitors the
size of the objects
within a schema. The danger here is that a user could potentially
create a huge table
as a result of a bad query (cartesian join etc) and fill the
application tablespace / filesystem.
You have answered your own question here. There isn't any facility in
PostgreSQL yet to enforce disk space usage, so if this requirement is a
must it's something you'll have to build yourself. The
tablespace->filesystem mapping you suggested is probably a good idea
to house these things at, to prevent one user from taking out the main
part of the database with something they do.
One way that you can try to limit the damage of rogue queries on top of
that is to set statement_timeout so they just get cancelled if they run
for too long. If the tables are being populated by a single statement
and you set that to a moderate amount of time, that should be effective
at cutting off any of the really bad ones after they've run for a
while. You'll have to experiment at just how long that timeout should
be. If you set log_min_duration_statement (which is a general good
idea in this situation anyway) and look at what kind of runtime common
intense but not crippling queries take, that's one way to get feedback
on where the timeout should be.
--
Greg Smith, 2ndQuadrant US greg(at)2ndQuadrant(dot)com Baltimore, MD
PostgreSQL Training, Services and Support www.2ndQuadrant.us
Author, "PostgreSQL 9.0 High Performance" Pre-ordering at:
https://www.packtpub.com/postgresql-9-0-high-performance/book
From | Date | Subject | |
---|---|---|---|
Next Message | Vishnu S. | 2010-10-21 04:02:15 | PostgreSQL Replication Using slony [Rejoining a node after failover] |
Previous Message | maiesky | 2010-10-20 12:38:53 | Can't remove filter when no rows returned |