Re: Optimizer failure on integer column?

From: Jonathan Bartlett <johnnyb(at)eskimo(dot)com>
To: pgsql general list <pgsql-general(at)postgresql(dot)org>
Subject: Re: Optimizer failure on integer column?
Date: 2003-06-10 14:23:25
Message-ID: Pine.GSU.4.44.0306100721040.2398-100000@eskimo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Is it an int8 column? If it is, you have to cast all raw numbers to
int8, or the optimizer won't catch that it can use the index.

For example, in perl

$dbh->prepare("select * from mytable where myinteger = ?::int8");

will be able to use the optimizer.

Jon

On Fri, 6 Jun 2003, Tom Lane wrote:

> nolan(at)celery(dot)tssi(dot)com writes:
> > Is there a documented problem with optimizing integer key fields
> > in 7.3.3?
>
> No. How about providing some more details, like EXPLAIN ANALYZE
> output? The given query plan looks reasonable if the planner's
> estimates are right ... but since you're complaining, I'd imagine
> they are not. (Also, I assume you've done an ANALYZE lately?)
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jonathan Bartlett 2003-06-10 14:25:07 Re: Pg_dumpall
Previous Message Tom Lane 2003-06-10 14:11:00 Re: host and hostssl equivalence in pg_hba.conf