Help understanding indexes - Mailing list pgsql-general

From chris.gamble@CPBINC.com
Subject Help understanding indexes
Date
Msg-id 00CA54A79070D411A9E20090273CEF1C14F32A@inet1.cpbinc.com
Whole thread Raw
Responses Re: Help understanding indexes  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-general
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???




pgsql-general by date:

Previous
From: Manfred Koizar
Date:
Subject: Re: Updates are slow..
Next
From: Martijn van Oosterhout
Date:
Subject: Re: Help understanding indexes