Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Fast bitwise search
Richard Kuhler wrote:
> Frank van Bortel wrote:
>
>> Richard Kuhler wrote: >> >>> kuntz.1507173_at_bloglines.com wrote: >>> >>>> we have a large table that contains a bitmask field: >>>> MASK NUMBER(19) >>>> >>>> The application then performs a query that includes BITAND(MASK, ?) > 0 >>>> condition. >>>> >>>> Is there any way to use an index for this condition. I was thinking >>>> about bitmap indexes for this but could not figure out how to use them >>>> here. >>> >>> >>> Why in the world would you bundle data up into a column like that? I >>> can't imagine why the correct solution isn't to break those bits out >>> into individual columns with descriptive names so people can actually >>> see what information is stored there. Then you could use bitmap >>> indexes on them if performance dictated it (keeping in mind the >>> problems they create). >>> >>> -- >>> Richard Kuhler >> >> >> Why would Oracle use this internally all over? (Check sql.bsq). >> For one, you can add a new mask, without adding columns to >> the design.
You do need to rewrite every bit of PL/SQL and Java; bitwise
operations do not require that.
Apart from that - it seems quite fast.
And one bitand(column) is easier to code
than where col1 = 1 and col2 = 'Y' and col3=...
....
and col75...
And I do not mimic Oracle code expert (wish I had the knowledge), but have not heard any technical reasons why I shouldn't use bitand. Datamodels are not the same as technical implementations.
-- Regards, Frank van BortelReceived on Wed Jun 02 2004 - 14:09:14 CDT