X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 17AA0D1D412 for ; Fri, 6 Feb 2004 15:52:42 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 53218-07 for ; Fri, 6 Feb 2004 11:52:40 -0400 (AST) Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by svr1.postgresql.org (Postfix) with ESMTP id EC437D1C7F7 for ; Fri, 6 Feb 2004 11:52:35 -0400 (AST) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id C93FD358A5; Fri, 6 Feb 2004 07:52:24 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id C7CC5352E6; Fri, 6 Feb 2004 07:52:24 -0800 (PST) Date: Fri, 6 Feb 2004 07:52:24 -0800 (PST) From: Stephan Szabo To: Bruno BAGUETTE Cc: pgsql-performance@postgresql.org Subject: Re: Increase performance of a UNION query that thakes In-Reply-To: Message-ID: <20040206074755.M86604@megazone.bigpanda.com> References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/92 X-Sequence-Number: 5616 On Fri, 6 Feb 2004, Bruno BAGUETTE wrote: > I was thinking that a index on lower(substr(l_name, 1, 1)) and another > index on lower(substr(org_name, 1, 1)) should gives better performances. > When I've to create theses two indexes, it seems like this is not > allowed : > > levure=> CREATE INDEX firstchar_lastname_idx ON > people(lower(substr(l_name, 1, 1))); > ERROR: parser: parse error at or near "(" at character 59 In 7.4, I believe you would say on people((lower(substr(l_name,1,1)))) but I'm not sure that index would really help in practice. > Do you have another idea to get better performances ? In addition to what Tom said, the row estimates look suspiciously default. You mention vacuuming, but do you ever analyze the tables? Also, what do you have sort_mem set to?