From: Scott Marlowe <smarlowe@g2switchworks.com>
To: Alain <alainm@pobox.com>
Cc: Sql-Postgre <pgsql-sql@postgresql.org>
Subject: Re: Tip ?
Date: Tue, 24 May 2005 13:34:07 -0500
Message-ID: <1116959646.31821.278.camel@state.g2switchworks.com> (raw)
In-Reply-To: <429371EA.30502@pobox.com>
References: <05d801c41bd8$daf4f8f0$0403a8c0@fejleszt4>
<42930447.2030801@gmail.com>
<429371EA.30502@pobox.com>
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.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: smarlowe@g2switchworks.com, alainm@pobox.com
Subject: Re: Tip ?
In-Reply-To: <1116959646.31821.278.camel@state.g2switchworks.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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