Re: index/join madness

Поиск
Список
Период
Сортировка
От jdassen@cistron.nl (J.H.M. Dassen (Ray))
Тема Re: index/join madness
Дата
Msg-id slrn9gngn1.oth.jdassen@odin.cistron-office.nl
обсуждение исходный текст
Ответ на index/join madness  ("Michael Richards" <michael@fastmail.ca>)
Список pgsql-sql
Michael Richards <michael@fastmail.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."



В списке pgsql-sql по дате отправления:

Предыдущее
От: "Chris Ruprecht"
Дата:
Сообщение: Select question
Следующее
От: David Olbersen
Дата:
Сообщение: Re: index/join madness