X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2B779D979F for ; Fri, 4 Nov 2005 11:05:45 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 21967-09 for ; Fri, 4 Nov 2005 15:05:41 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by svr1.postgresql.org (Postfix) with ESMTP id C267AD982E for ; Fri, 4 Nov 2005 11:05:43 -0400 (AST) Received: from mainbox.archonet.com (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id E6D4740C066; Fri, 4 Nov 2005 15:05:20 +0000 (GMT) Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id 407A815EDA; Fri, 4 Nov 2005 15:01:08 +0000 (GMT) Received: from mainbox.archonet.com ([127.0.0.1]) by localhost (mainbox [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 04715-07; Fri, 4 Nov 2005 15:01:05 +0000 (GMT) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id A7C8A15ED9; Fri, 4 Nov 2005 15:01:05 +0000 (GMT) Message-ID: <436B77B1.7090602@archonet.com> Date: Fri, 04 Nov 2005 15:01:05 +0000 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051013) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Michal Taborsky Cc: pgsql-performance@postgresql.org Subject: Re: Searching union views not using indices References: <436B4836.7030300@mall.cz> In-Reply-To: <436B4836.7030300@mall.cz> Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.033 required=5 tests=[AWL=0.033] X-Spam-Score: 0.033 X-Spam-Level: X-Archive-Number: 200511/72 X-Sequence-Number: 15329 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