pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedTip ?
2+ messages / 2 participants
[nested] [flat]
* Tip ?
@ 2005-05-24 18:26 Alain <alainm@pobox.com>
0 siblings, 1 reply; 2+ messages in thread
From: Alain @ 2005-05-24 18:26 UTC (permalink / raw)
To: pgsql-sql
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?
thanks,
Alain
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Tip ?
@ 2005-05-24 18:34 Scott Marlowe <smarlowe@g2switchworks.com>
parent: Alain <alainm@pobox.com>
0 siblings, 0 replies; 2+ messages in thread
From: Scott Marlowe @ 2005-05-24 18:34 UTC (permalink / raw)
To: Alain <alainm@pobox.com>; +Cc: 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.
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2005-05-24 18:34 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-05-24 18:26 Tip ? Alain <alainm@pobox.com>
2005-05-24 18:34 ` Scott Marlowe <smarlowe@g2switchworks.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox