Re: Bug #790: Optimizer does not want to use an index for large table

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: jeecha(at)one(dot)lv, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Bug #790: Optimizer does not want to use an index for large table
Date: 2002-09-29 15:09:42
Message-ID: 10878.1033312182@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

pgsql-bugs(at)postgresql(dot)org writes:
> CREATE TABLE obj_props(obj_id int8,name text,value text);
^^^^^^^^^^^

You need an explicit cast, like this:

EXPLAIN SELECT name,value FROM obj_props WHERE obj_id = 100::int8;

because the planner is not smart about converting cross-datatype
comparisons into indexscans, and unadorned "100" is taken as int4.

I think we will finally have a fix for this in 7.4.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tim Knowles 2002-09-30 13:27:12 Bug #785: 7.3b2 : Possible Inconsistency with DROP INDEX ... CASCADE and DROP CONSTRAINT
Previous Message Rod Taylor 2002-09-29 13:46:43 Re: Bug #790: Optimizer does not want to use an index for