Re: Bug #790: Optimizer does not want to use an index for large table - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Bug #790: Optimizer does not want to use an index for large table
Date
Msg-id 10878.1033312182@sss.pgh.pa.us
Whole thread Raw
In response to Bug #790: Optimizer does not want to use an index for large table  (pgsql-bugs@postgresql.org)
List pgsql-bugs
pgsql-bugs@postgresql.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

pgsql-bugs by date:

Previous
From: Rod Taylor
Date:
Subject: Re: Bug #790: Optimizer does not want to use an index for
Next
From: "Tim Knowles"
Date:
Subject: Bug #785: 7.3b2 : Possible Inconsistency with DROP INDEX ... CASCADE and DROP CONSTRAINT