Re: Searching union views not using indices - Mailing list pgsql-performance

From Richard Huxton
Subject Re: Searching union views not using indices
Date
Msg-id 436B77B1.7090602@archonet.com
Whole thread Raw
In response to Searching union views not using indices  (Michal Taborsky <michal.taborsky@mall.cz>)
List pgsql-performance
Michal Taborsky wrote:
...
> UNION
...
> The result is sequential scan on all tables, append, sort and then
> filter scan on this whole thing. Which of course is slow as hell. We use
> version 8.0.2.
>
> And now the question: Is there a way to force the planner to push the
> condition lower, so it will use the index? Or do you use some tricks in
> this scenario? Thanks for your suggestions.

Try "UNION ALL", since UNION is defined as removing duplicates, which
probably accounts for the sort.

--
   Richard Huxton
   Archonet Ltd

pgsql-performance by date:

Previous
From: Tom Lane
Date:
Subject: Re: insert performance for win32
Next
From: "Merlin Moncure"
Date:
Subject: Re: Searching union views not using indices