Re: index/join madness

From: jdassen(at)cistron(dot)nl (J(dot)H(dot)M(dot) Dassen (Ray))
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: index/join madness
Date: 2001-05-23 14:02:09
Message-ID: slrn9gngn1.oth.jdassen@odin.cistron-office.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Michael Richards <michael(at)fastmail(dot)ca> 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."

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message David Olbersen 2001-05-23 15:37:06 Re: index/join madness
Previous Message Chris Ruprecht 2001-05-23 13:23:39 Select question