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

From Jon Nelson
Subject Re: views, queries, and locks
Date
Msg-id CAKuK5J13L4zHL2csNV-PVrkX-UheNagbPcNVL-ZD5QYoFkg2Ww@mail.gmail.com
Whole thread Raw
In response to Re: views, queries, and locks  (Thomas Kellerer <spam_eater@gmx.net>)
Responses Re: views, queries, and locks  (Scott Marlowe <scott.marlowe@gmail.com>)
List pgsql-general
On Tue, Apr 3, 2012 at 2:45 PM, Thomas Kellerer <spam_eater@gmx.net> wrote:
> Jon Nelson wrote on 03.04.2012 20:41:
>
>> 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.
>
>
> Can't you use table inheritance for that?


Not efficiently. My view looks like this:

select <bunch of stuff from table A>, DATE 'date string here' as
some_date_column
UNION ALL
select <bunch of stuff from table B>, DATE 'date string here' as
some_date_column
....

for lots and lots of tables. Storing that DATE would be cost
prohibitive and inefficient, since the same value would be used
throughout each 'sub' table. This let's me do queries that involve
'some_date_column' and the query optimizer will remove the tables that
don't apply, etc.

--
Jon

pgsql-general by date:

Previous
From: John R Pierce
Date:
Subject: Re: Re: Please help me to take a look of the erros in my functions. Thanks.
Next
From: Scott Marlowe
Date:
Subject: Re: views, queries, and locks