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 6804659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:29:37+00:00 2026-05-26T19:29:37+00:00

If I have 8 boolean values in a record and those 8 values are

  • 0

If I have 8 boolean values in a record and those 8 values are always used when doing a query against the table and the data in the table is static (read-only), is it faster to get matching records by indexing and querying against a one byte field like binary(1) or is it better to have 8 separate bit columns with all 8 added to an index?

  • 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-26T19:29:38+00:00Added an answer on May 26, 2026 at 7:29 pm

    Indexes on single bit field will be basically useless. A bit has terrible selectivity, 0 or 1, and will be likely disregarded by the optimizer. 8 indexes on 8 bit fields are going to be 8 indexes disregarded by the optimizer.

    An index on a byte column is only slightly more selective, with 256 distinct values. But if you are seeking individual bit patterns, like ‘is bit 3 on’, then there are no way to express this as a individual value to seek nor as a range.

    Conclusion is that no matter what you try, you will end up with a table scan anyway.

    So better explain what is your problem, not your solution, and perhaps we can think at something more efficient.

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

Sidebar

Related Questions

I have a table which has essentially boolean values in a legacy database. The
I have a query that updates a boolean value for a given record, then
I have a set of five boolean values. If more than one of these
I have a boolean (BOOL) type field in the SQLite table. In the SubSonic
If I have a boolean field like: private static final boolean DEBUG = false;
I have a table with a foreign key and a boolean value (and a
I have a table named categories, which contains ID(long), Name(varchar(50)), parentID(long), and shownByDefault(boolean) columns.
I have a record like this: Tcustomer=record Name: string; IDNumber: Integer; IsMarried: boolean; end;
I have a field in a table that is boolean, a range of records
I have a problem with inserting data into SQLite database using QSqlTableModel. The table

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.