Help understanding indexes

From: chris(dot)gamble(at)CPBINC(dot)com
To: pgsql-general(at)postgresql(dot)org
Subject: Help understanding indexes
Date: 2002-06-12 15:18:50
Message-ID: 00CA54A79070D411A9E20090273CEF1C14F32A@inet1.cpbinc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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???

Responses

Browse pgsql-general by date

  From Date Subject
Next Message chris.gamble 2002-06-12 15:36:51 Re: Help understanding indexes
Previous Message Manfred Koizar 2002-06-12 15:08:40 Re: Updates are slow..