Re: How can I Improve performance in Solaris?

From: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
To: ingrid martinez <ingridm(at)qoslabs(dot)com>
Cc: Andrew Sullivan <andrew(at)libertyrms(dot)info>, <pgsql-performance(at)postgresql(dot)org>
Subject: Re: How can I Improve performance in Solaris?
Date: 2003-08-13 19:00:23
Message-ID: Pine.LNX.4.33.0308131256280.7316-100000@css120.ihs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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
>

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Christopher Browne 2003-08-13 19:07:04 Re: Perfomance Tuning
Previous Message Christopher Browne 2003-08-13 18:54:38 Re: Perfomance Tuning