I am working on a project that will use a large database (11 million
records). I have the following fields:
customerid bigint
longitude float8
latitude float8
my indexes are:
idxcust on customerid
idxloc on longitude, latitude
I run queries like
SELECT * FROM tdatcustomerlist WHERE customerid=4237095
but postgres will not use my indexes. I have found the workaround here as:
SELECT * FROM tdatcustomerlist WHERE customerid=4237095::BIGINT
but this is not very portable sql.
also, i have a query that tries to do greater than less than queries against
long / lat fields, but I have not yet discovered a way to get those queries
to use indexes. I have tried using the float8gt/lt functions, and tried
using type casting. Does anyone have helpful explanations???