Re: Indexes not used in 7.1RC4: Bug? - Mailing list pgsql-hackers

From Thomas Lockhart
Subject Re: Indexes not used in 7.1RC4: Bug?
Date
Msg-id 3AD47334.25B9AC9A@alumni.caltech.edu
Whole thread Raw
In response to Re: Indexes not used in 7.1RC4: Bug?  (Thomas Lockhart <lockhart@alumni.caltech.edu>)
List pgsql-hackers
> What about going the other way around... Promote the int2 to an int4
> (lossless).  Actually for all int1,int2 datatypes (regardless of whether it
> was the constant or the column) you could promote all to a common int4 and
> then do comparisons.

That is why the index is not used: the backend is promoting all of the
int2 column values to 
int4 for the comparison, and concludes that the available index is not
relevant.

The index traversal code would need to know how to promote individual
values in the index for comparison, which is an interesting idea but I
haven't thought about how efficient it would be. Clearly the cost would
be different than a simple comparison.
                      - Thomas


pgsql-hackers by date:

Previous
From: Vince Vielhaber
Date:
Subject: Re: Re: HOLD THE PRESSES!! ... pg_dump from v7.0.3 can't import to v7.1?
Next
From: Peter Eisentraut
Date:
Subject: Re: Re: HOLD THE PRESSES!! ... pg_dump from v7.0.3 can't import to v7.1?