From: Stephan Szabo <sszabo@megazone23.bigpanda.com>
To: Josh Berkus <josh@agliodbs.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Indexing UNIONs
Date: Mon, 15 Jul 2002 13:12:52 -0700 (PDT)
Message-ID: <20020715130911.V41271-100000@megazone23.bigpanda.com> (raw)
In-Reply-To: <200207151200.07766.josh@agliodbs.com>
On Mon, 15 Jul 2002, Josh Berkus wrote:
> Folks,
>
> I have two tables which are often browsed together through a UNION view, like:
>
> CREATE VIEW two_tables AS
> SELECT t1.id, t1.name, t1.abbreviation, t1.juris_id
> FROM t1
> UNION ALL
> SELECT t2.id, t2.name, NULL, t2.juris_id
> FROM t2;
>
> This works fine as a view, since I have made the id's unique between the two
> tables (using a sequence). However, as t1 has 100,000 records, it is
> vitally important that queries against this view use an index.
We had a discussion recently on -general about this. Right now the
planner won't push the conditions down into the arms of the union because
noone's been sure under what conditions the optimization is safe.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: sszabo@megazone23.bigpanda.com, josh@agliodbs.com
Subject: Re: Indexing UNIONs
In-Reply-To: <20020715130911.V41271-100000@megazone23.bigpanda.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox