Re: Tip ?

Поиск
Список
Период
Сортировка
От Scott Marlowe
Тема Re: Tip ?
Дата
Msg-id 1116959646.31821.278.camel@state.g2switchworks.com
обсуждение исходный текст
Ответ на Tip ?  (Alain <alainm@pobox.com>)
Список pgsql-sql
On Tue, 2005-05-24 at 13:26, Alain wrote:
> This tip was at the end of a message (from Szűcs Gábor).
>
> > TIP 9: the planner will ignore your desire to choose an index scan if your
> >      joining column's datatypes do not match
>
> it looks very important, but I cannot understand it. Sound as a small
> and easy mistake that can make things go sour...
>
> Can someone explain it please?

Note that this is mostly fixed in V 8.0

What it means is that if you have a table with a field of type numeric,
and you join another table against it with a field of type integer, the
query planner won't know it can use the indexes on those two fields
(assuming you DO have indexes on them) when joining and use a sequential
scan all the time.

Casting one field to the other's type, or changing the type of one to
the other's type will allow the planner to use the index.


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

Предыдущее
От: Alain
Дата:
Сообщение: Tip ?
Следующее
От: lucas@presserv.org
Дата:
Сообщение: Duplicated records