Re: Postmaster won't -HUP

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jerry Lynde <jlynde(at)diligence(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Postmaster won't -HUP
Date: 2000-06-01 21:58:33
Message-ID: 26508.959896713@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Jerry Lynde <jlynde(at)diligence(dot)com> writes:
>>>> They are all indexed, the DOB index is actually DOBYear DOBDay and
>>>> DOBMonth and all 5 fields are indexed
>>
>> Do you have 5 indexes or do you have an index that spans more than one
>> field?

> Sorry for being less than explicit. There are 5 separate indices, one per
> field.

So your query is really something more like

... WHERE firstname = 'joe' AND lastname = 'blow' AND
DOByear = 1999 AND DOBmonth = 1 AND DOBday = 1

?

The problem here is that only one index can be used in any individual
scan. If I were the optimizer I'd probably figure that lastname is
going to be the most selective of the five available choices, too.

I'd suggest storing the DOB as *one* field of type 'date'. You can
pull out the subparts for display with date_part() when you need to,
but for searches you'll be a lot better off with

WHERE DOB = '1999-01-01'

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message leonbloy 2000-06-01 22:10:48 Re: btree index and max()
Previous Message Tom Lane 2000-06-01 21:42:07 Re: btree index and max()