Re: views, queries, and locks - Mailing list pgsql-general

From Merlin Moncure
Subject Re: views, queries, and locks
Date
Msg-id CAHyXU0zjWg1mMYpPjoCRR_t_Ex1qYgLGuZRfEYFd+Zvz+gi+Yw@mail.gmail.com
Whole thread Raw
In response to Re: views, queries, and locks  (Jon Nelson <jnelson+pgsql@jamponi.net>)
List pgsql-general
On Tue, Apr 3, 2012 at 1:41 PM, Jon Nelson <jnelson+pgsql@jamponi.net> wrote:
> On Tue, Apr 3, 2012 at 1:36 PM, Merlin Moncure <mmoncure@gmail.com> wrote:
>> Generally speaking, in SQL, locks are held until the transaction
>> commits; there are tons of reasons why things have to work that way.
>> Anyways, I'm betting your requirement to have to re-CREATE the view
>> can be abstracted out somehow.  I'm guessing you have some type of
>> table rotation going on?
>
> Close, but not quite. It's not rotation but every N minutes a
> newly-built table appears. I'd like that table to appear as part of
> the view as soon as possible.

How sophisticated are the queries that are touching this view?  How
much data in the tables?  If you don't need to push quals down into
the view, we can do a view wrapping function that can pick up the new
tables.

> Regarding locks: I know that's how locks usually work - but what I'm
> asking is if holding on to the lock for the view, once the view has
> been 'expanded', is necessary at all.

Unfortunately, it is.

merlin

pgsql-general by date:

Previous
From: Bartosz Dmytrak
Date:
Subject: Re: Re: Please help me to take a look of the erros in my functions. Thanks.
Next
From: Thomas Kellerer
Date:
Subject: Re: views, queries, and locks