| From: | Scott Marlowe <smarlowe(at)g2switchworks(dot)com> |
|---|---|
| To: | Alain <alainm(at)pobox(dot)com> |
| Cc: | Sql-Postgre <pgsql-sql(at)postgresql(dot)org> |
| Subject: | Re: Tip ? |
| Date: | 2005-05-24 18:34:07 |
| Message-ID: | 1116959646.31821.278.camel@state.g2switchworks.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs 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.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Neil Conway | 2005-05-25 00:28:35 | Re: BUG #1678: pw_shadow BUS ERROR |
| Previous Message | Alain | 2005-05-24 18:26:50 | Tip ? |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | J.Bougani | 2005-05-24 20:25:54 | Geschäftliches Angebot |
| Previous Message | Alain | 2005-05-24 18:26:50 | Tip ? |