Jerry Lynde <jlynde@diligence.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