Received: from ncc1701.cistron.net (ncc1701.cistron.net [195.64.68.38]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f4NE2IA82487 for ; Wed, 23 May 2001 10:02:18 -0400 (EDT) (envelope-from news@uucp.cistron.nl) Received: from news by ncc1701.cistron.net with local (Exim 3.20 #1 (Debian)) id 152ZDF-0000iH-00 for ; Wed, 23 May 2001 16:02:09 +0200 From: jdassen@cistron.nl (J.H.M. Dassen (Ray)) Subject: Re: index/join madness Date: Wed, 23 May 2001 14:02:09 +0000 (UTC) Organization: Cistron Internet Services B.V. Lines: 27 Message-ID: References: <3B0B4776.0001A9.50190@frodo.searchcanada.ca> X-Trace: ncc1701.cistron.net 990626529 1673 195.64.65.236 (23 May 2001 14:02:09 GMT) X-Complaints-To: abuse@cistron.nl To: pgsql-sql@postgresql.org Errors-To: <> X-Archive-Number: 200105/250 X-Sequence-Number: 3078 Michael Richards wrote: > Ok, I've built the most insane query ever. Indeed. Kindly stay away from sharp objects and wait for the friendly people to bring you to the bouncy room :-) > If anyone has a screen wide enough to see this, you will see that the > majority of the time is spent doing sequential scans on the formdata > table. This table needs formid, fieldid and userid to find the value I'm > looking for. > In my case I'm ignoring occid since it's always 1 for these values. What happens if you put in an "and occid = 1"? Perhaps it's the case that you know it's always one, but the query planner doesn't realise this. > I'm a little curious as to why it's not using the primary key... Another possible cause which I've seen in a couple of recent threads is that the query analyzer isn't very smart about the relationships between types, so it may help to explicitly cast values to the exact type used in the index. HTH, Ray -- "Never trust a poll you haven't rigged yourself."