SQL Interview: 3: Are bit columns useful in indexes?
This is a post in the SQL Interview series. These aren’t trick or gotcha questions, they’re just questions designed to scope out a candidate’s knowledge around SQL Server and Azure SQL Database.
Section: Query Performance Level: Medium
Question:
In SQL Server a column that is defined with a bit data type can only have the values 0, or 1, or it can be NULL if the column allows it.
Given such a small number of possible values, are bit columns ever useful in indexes? Can you give an example of when they might or might not be useful?
2021-03-26