Eddy Escardo-Raffo <eescardo@kikini.com> writes:
> Do you guys have any idea why this is not working as I expect?
Datatype issue maybe? When I try what seems to be the same case here
I get the expected indexscan, so I'm thinking the problem is that
the comparison isn't indexable, which is a possibility if the location
column isn't actually integer.
The fact that it's estimating 1000000 rows out is also extremely
suspicious --- it might or might not get the exact "2" estimate,
but I'd sure expect it to know that the majority of rows don't match.
regards, tom lane