Re: are views typically any faster/slower than - Mailing list pgsql-performance

From Rod Taylor
Subject Re: are views typically any faster/slower than
Date
Msg-id 1054468575.11968.95.camel@jester
Whole thread Raw
In response to Re: are views typically any faster/slower than equivilent joins?  (Bruno Wolff III <bruno@wolff.to>)
List pgsql-performance
On Sun, 2003-06-01 at 01:43, Bruno Wolff III wrote:
> On Sun, Jun 01, 2003 at 00:02:39 -0400,
>   Rod Taylor <rbt@rbt.ca> wrote:
> >
> > Some views such as unions will not be as fast as you would like, but
> > thats a general issue with PostgreSQLs inability to throw away selects
> > when it won't find results on one side of a union.
> >
> > CREATE VIEW sales AS SELECT * FROM sales_archive_2002 UNION ALL SELECT *
> > FROM sales_current;
> >
> >
> > SELECT * FROM sales WHERE timestamp => CURRENT_TIMESTAMP - INTERVAL '1
> > day';
> >
> > The above query would not be so quick.
>
> I thought some work had been done on pushing where conditions down into
> unions? If so the above wouldn't be too bad. It would still look at
> the archive table, but it should return no rows relatively quickly
> assuming an appropiate index exists.

Certainly, if the index exists it won't be so bad (for any single
archive table).  It's when the index doesn't exist or there are several
hundred archive tables then it starts to get a little worse.

Anyway, anyone doing the above in PostgreSQL should probably be looking
at partial indexes and merging the information back into a single table
again.

--
Rod Taylor <rbt@rbt.ca>

PGP Key: http://www.rbt.ca/rbtpub.asc

Attachment

pgsql-performance by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: are views typically any faster/slower than equivilent joins?
Next
From: Rod Taylor
Date:
Subject: Re: Index speeds up one row table (why)?