Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 0BB9C9F9F18 for ; Mon, 17 Sep 2007 11:40:58 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 00633-04 for ; Mon, 17 Sep 2007 11:40:54 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from nz-out-0506.google.com (nz-out-0506.google.com [64.233.162.226]) by postgresql.org (Postfix) with ESMTP id 42E489F9F84 for ; Mon, 17 Sep 2007 11:40:54 -0300 (ADT) Received: by nz-out-0506.google.com with SMTP id l8so783859nzf for ; Mon, 17 Sep 2007 07:40:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; bh=uQIxGpNWl0+XgjA5Huqe6YFx7H5TFXb/+7kZXLPKy1I=; b=j6+sDz8WoN4w55rIMH27t9RJJqcKv2MYTnMHouRCP0CmDazTRS7izy8argddiwUgUglFIC3fW96I5QcJp6krOANjMk4AK3M7BLxQX1NuFijARaVSneHCmtjtTwJcvBqNQ/7SwXpwtzkUooKQqlJooOX2f1TzZbt77Qrz6psSTQE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=aNiHcAN5b/NjyC0B+NdZRUqsUFCiHZX3TkiAYj/frUi+HlQJHnUDxRonsU36uyZKicdPtZW9qx3J/JPU8Z/jkkha/ClCJQLrBlglPHNwnfa5Nr65CrA9blPxrP9vcfsPJ8nLmj85DsGujWbLOSrQ8mH674oTQvgD3l8j9T3AXgg= Received: by 10.142.229.4 with SMTP id b4mr912060wfh.1190040049081; Mon, 17 Sep 2007 07:40:49 -0700 (PDT) Received: by 10.143.157.7 with HTTP; Mon, 17 Sep 2007 07:40:49 -0700 (PDT) Message-ID: Date: Mon, 17 Sep 2007 16:40:49 +0200 From: "W.Alphonse HAROUNY" To: "Tom Lane" Subject: Re: Index usage when bitwise operator is used Cc: "Kevin Grittner" , valgog , pgsql-performance@postgresql.org In-Reply-To: <21403.1190036229@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_8020_17976191.1190040049065" References: <46ED7CCD.EE98.0025.0@wicourts.gov> <1190015368.148293.56830@y42g2000hsy.googlegroups.com> <46EE2C53.EE98.0025.0@wicourts.gov> <21403.1190036229@sss.pgh.pa.us> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200709/295 X-Sequence-Number: 26840 ------=_Part_8020_17976191.1190040049065 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, A little clarification. Actually, TBL1.CATEGORY and/or TBL2.CATEGORY may hold a binary value having multiple binary(ies) '1'. Each binary value column represent an business attribute. If a binary value column is equal to '1', it means that the business attribute is True, otherwise it is false. I adopted this avoid defining a detail table to table TBL1. Idem to TBL2. If TBL1.CATEGORY | TBL2.CATEGORY > 0 => it means that we have at least one common business attribute that is TRUE for TBL1 and TBL2. Regards W.Alf On 9/17/07, Tom Lane wrote: > > "Kevin Grittner" writes: > > On Mon, Sep 17, 2007 at 2:49 AM, in message > > <1190015368.148293.56830@y42g2000hsy.googlegroups.com>, valgog > > wrote:=20 > >> Are you sure you understood what was the question? > >> > >> Is the TBL1.CATEGORY = TBL2.CATEGORY the same as TBL1.CATEGORY & > >> TBL2.CATEGORY > 0? > > > Yes, given that he stipulated that one and only one bit would be set. > > Really? In that case, isn't this bit-field just a bad implementation of > an enum-style field? > > regards, tom lane > > ---------------------------(end of broadcast)--------------------------- > TIP 1: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly > ------=_Part_8020_17976191.1190040049065 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline
Hi, 
 
A little clarification. Actually,  TBL1.CATEGORY and/or  TBL2.CATEGORY may hold a binary value having multiple binary(ies) '1'.
Each binary value column represent an business attribute.
If a binary value column is equal to '1', it means that the business attribute is True,
otherwise it is false.
I adopted this avoid defining a detail table to table TBL1. Idem to TBL2.
 
If  TBL1.CATEGORY |  TBL2.CATEGORY > 0
=> it means that we have at least one common business attribute that is TRUE for TBL1 and TBL2.
 
Regards
W.Alf


On 9/17/07, Tom Lane <tgl@sss.pgh.pa.us> wrote:
"Kevin Grittner" <Kevin.Grittner@wicourts.gov > writes:
> On Mon, Sep 17, 2007 at  2:49 AM, in message
> <1190015368.148293.56830@y42g2000hsy.googlegroups.com>, valgog
> < valgog@gmail.com> wrote:=20
>> Are you sure you understood what was the question?
>>
>> Is the TBL1.CATEGORY = TBL2.CATEGORY the same as TBL1.CATEGORY &
>> TBL2.CATEGORY > 0?

> Yes, given that he stipulated that one and only one bit would be set.

Really?  In that case, isn't this bit-field just a bad implementation of
an enum-style field?

                       regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to majordomo@postgresql.org so that your
      message can get through to the mailing list cleanly

------=_Part_8020_17976191.1190040049065--