Rod Taylor wrote:
> With one potential snafu -- it blocks new SELECTs against the parent
> table while truncate runs on the child (happens with constraint
> exclusion as well).
>
> If your transactions are short then it won't be an issue. If you have
> mixed length transactions (many short which the occasional long select)
> then it becomes tricky since those short transactions will be blocked.
One idea is to try to acquire the lock before issuing the TRUNCATE
itself. If the LOCK TABLE times out, you know you should wait for a
long-running transaction ...
--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.