pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Index + mismatching datatypes [WAS: index on custom function; explain]
2+ messages / 2 participants
[nested] [flat]

* Index + mismatching datatypes [WAS: index on custom function; explain]
@ 2005-11-07 18:07  Enrico Weigelt <weigelt@metux.de>
  0 siblings, 1 reply; 2+ messages in thread

From: Enrico Weigelt @ 2005-11-07 18:07 UTC (permalink / raw)
  To: pgsql-performance

* Yann Michel <yann-postgresql@spline.de> wrote:

> TIP 9: In versions below 8.0, the planner will ignore your desire to
>        choose an index scan if your joining column's datatypes do not
>        match

I've got a similar problem: I have to match different datatypes,
ie. bigint vs. integer vs. oid.

Of course I tried to use casted index (aka ON (foo::oid)), but 
it didn't work. 

What am I doing wrong ?


cu
-- 
---------------------------------------------------------------------
 Enrico Weigelt    ==   metux IT service
  phone:     +49 36207 519931         www:       http://www.metux.de/
  fax:       +49 36207 519932         email:     contact@metux.de
---------------------------------------------------------------------
  Realtime Forex/Stock Exchange trading powered by postgreSQL :))
                                            http://www.fxignal.net/
---------------------------------------------------------------------



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Index + mismatching datatypes [WAS: index on custom
@ 2005-11-07 20:45  Neil Conway <neilc@samurai.com>
  parent: Enrico Weigelt <weigelt@metux.de>
  0 siblings, 0 replies; 2+ messages in thread

From: Neil Conway @ 2005-11-07 20:45 UTC (permalink / raw)
  To: weigelt@metux.de; +Cc: pgsql-performance

On Mon, 2005-07-11 at 19:07 +0100, Enrico Weigelt wrote:
> I've got a similar problem: I have to match different datatypes,
> ie. bigint vs. integer vs. oid.
> 
> Of course I tried to use casted index (aka ON (foo::oid)), but 
> it didn't work.  

Don't include the cast in the index definition, include it in the query
itself:

    SELECT ... FROM foo WHERE int8col = 5::int8

for example. Alternatively, upgrade to 8.0 or better, which doesn't
require this workaround.

-Neil





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2005-11-07 20:45 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-11-07 18:07 Index + mismatching datatypes [WAS: index on custom function; explain] Enrico Weigelt <weigelt@metux.de>
2005-11-07 20:45 ` Re: Index + mismatching datatypes [WAS: index on custom Neil Conway <neilc@samurai.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