Re: Index usage when bitwise operator is used

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "W(dot)Alphonse HAROUNY" <wharouny(at)gmail(dot)com>, <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Index usage when bitwise operator is used
Date: 2007-09-16 23:58:21
Message-ID: 46ED7CCD.EE98.0025.0@wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

>>> On Thu, Sep 13, 2007 at 7:30 AM, in message
<f97d4e240709130530ve3cc522g61ccca23335618f4(at)mail(dot)gmail(dot)com>, "W.Alphonse
HAROUNY" <wharouny(at)gmail(dot)com> wrote:

> and each binary value of [variableCategory] may only hold a single binary
> '1'.

> TBL1.CATEGORY & TBL2.CATEGORY <> 0 //-- where & is the AND bitwise
> operator

What about saying?:

TBL1.CATEGORY = TBL2.CATEGORY

If your indexes include this and the other columns which cause the tables
to be related, one or both of them stand a pretty good chance of evaluating
to the lowest-cost method to join the tables. Forcing a query to use an
index outside of it being the cheapest path is rarely productive.

-Kevin

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message valgog 2007-09-17 07:47:32 Re: Index usage when bitwise operator is used
Previous Message Kevin Grittner 2007-09-16 20:00:48 Re: random_page_costs - are defaults of 4.0 realistic for SCSI RAID 1