Received: from shire.ontko.com (shire.ontko.com [199.164.165.1]) by postgresql.org (8.11.3/8.11.4) with ESMTP id g0BGxkB54080 for ; Fri, 11 Jan 2002 11:59:46 -0500 (EST) (envelope-from nickf@ontko.com) Received: from nick (bilbo.ontko.com [199.164.165.101]) by shire.ontko.com (8.9.3/8.9.3/Debian 8.9.3-21) with SMTP id LAA06797; Fri, 11 Jan 2002 11:59:50 -0500 X-Authentication-Warning: shire.ontko.com: Host bilbo.ontko.com [199.164.165.101] claimed to be nick Reply-To: From: "Nick Fankhauser" To: "Frank Bax" , , "Guru\(External\)" Subject: Re: Resources Date: Fri, 11 Jan 2002 11:56:08 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) Importance: Normal In-Reply-To: <3.0.6.32.20020111112758.01d7feb0@pop6.sympatico.ca> X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 X-Archive-Number: 200201/90 X-Sequence-Number: 6179 > Sorry, I made too general a statement. Index will help when the expession ...and I didn't notice that Gurudutt's LIKE wasn't anchored to the front. oops- mea culpa. Taking a second look then, the LIKE is probably very costly. Take a look at the section in the Docs on making explicit joins. If the date check significantly constrains the results, index it & then make sure that constraint gets evaluated first, then the sequential scan on the address has less to scan. This might help a lot. The doc page for explicit joins: http://www.postgresql.org/idocs/index.php?explicit-joins.html You mention that it may be too late to change the tables, but I guess that's where I'd look next- I once had a similar situation when I worked for an electric utility & we ended up parsing the address lines to find road names & numbers and then loading them into special indexed fields just used for sorting. If you control the input app, maybe you could even have the user enter the fields you want to query on separately. -Nick