Re: How can I Improve performance in Solaris? - Mailing list pgsql-performance

From scott.marlowe
Subject Re: How can I Improve performance in Solaris?
Date
Msg-id Pine.LNX.4.33.0308131256280.7316-100000@css120.ihs.com
Whole thread Raw
In response to Re: How can I Improve performance in Solaris?  (ingrid martinez <ingridm@qoslabs.com>)
List pgsql-performance
More than likely you are suffering from an affliction known as type
mismatch.  This is listed as tip 9 here on the performance list (funny, it
was sent at the bottom of your reply :-)

What happens is that when you do:

select * from some_table where id=123;

where id is a bigint the query planner assumes you must want 123
cast to int4, which doesn't match int8 (aka bigint) and uses a sequential
scan to access that row.  I.e. it reads the whole table in.

You can force the planner to do the right thing here in a couple of ways:

select * from some_table where id=123::bigint;

-- OR --

select * from some_table where id='123';

On Wed, 13 Aug 2003, ingrid martinez wrote:

> the primary key is   flidload
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
>       joining column's datatypes do not match
>



pgsql-performance by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Perfomance Tuning
Next
From: Christopher Browne
Date:
Subject: Re: Perfomance Tuning