Re: Index usage when bitwise operator is used

From: "W(dot)Alphonse HAROUNY" <wharouny(at)gmail(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>, valgog <valgog(at)gmail(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Index usage when bitwise operator is used
Date: 2007-09-17 14:40:49
Message-ID: f97d4e240709170740g57c2169kaf8808339399b8bf@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

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(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov> writes:
> > On Mon, Sep 17, 2007 at 2:49 AM, in message
> > <1190015368(dot)148293(dot)56830(at)y42g2000hsy(dot)googlegroups(dot)com>, valgog
> > <valgog(at)gmail(dot)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(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Markus Schiltknecht 2007-09-17 15:19:31 Re: DRBD and Postgres: how to improve the perfomance?
Previous Message Kevin Grittner 2007-09-17 14:30:26 Re: Index usage when bitwise operator is used