Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6923997
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:36:27+00:00 2026-05-27T10:36:27+00:00

Could someone point us to information on (or opine on) BITMAP usages to store

  • 0

Could someone point us to information on (or opine on) BITMAP usages to store 100’s of indicator-like (on/off) attributes of a data object.

For example, if the “California” record in the STATE table had 120 indicator-like attributes and these attributes uniquely identify California, would it be wise to store these indicators in a VARCHAR(2) field (assuming a 64-bit system)?

We use the 120 attributes to resolve to California’s surrogate key. Our Db is SQL Server. We are also discussing adding 120 one character or one bit fields or a single VARCHAR(120) field.

Many thanks for all help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T10:36:27+00:00Added an answer on May 27, 2026 at 10:36 am

    VARCHAR(2) stores 2 characters, not ‘128 bits on 64-bit platforms’ as you seem to expect. Besides, the internal representation is such as to honor the guarantee that the on-disk format is portable across architectures. Ie. 64-bit system represents the VARCHAR(2) the same way as an x86 system.

    If you want to store bitmap, that would be binary data, then use BINARY type. You can represent 120 attributes in a BINARY(16) type. Such a storage is very dense and space efficient, but is very difficult to search and index. While SQL Server supports bitwise operators, searching such a bitmap field for example to retrieve all records that have bit 7, bit 12 off and bit 18 on can only be done by an end-to-end, size-of-data, table scan.

    Also, instead of using a BINARY(16) field to store 120 single bit attributes, consider declaring 120 BIT columns in the table. They would require 2 bits for storage (one bit for data, 1 bit for NULLability), but your code will be much cleaner and readable as it actually manipulate named columns as opposed to cryptic bitwise operations. Sargability of this solution is same as the BINARY(16) one (ie. no seeks, only table scans).

    You should also read about sparse columns and filtered indexes, both concepts are very likely to apply to your design.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Could someone please point me in the right direction with respect to OHLC data
Could someone point me to a guide or some information on building a simple
Could someone point me in the right direction on how you get your Page
Could someone point out to me which directory I should be using to work
As I'm not strong with apache could someone point me in right direction with
Could someone please point out a site where I can find an algorithm to
If someone could point me to some good resources on building a stateless web
Just wondering if someone could point me in the right direction of how to
I am wondering if someone could point me in the right direction. You know
I was just hoping that someone could point me to a reference that defines

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.