From the course: Advanced SQL for Data Scientists

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Bitmap indexes

Bitmap indexes

From the course: Advanced SQL for Data Scientists

Start my 1-month free trial

Bitmap indexes

- [Instructor] Let's take a look at bitmap indexes. Now, a bitmap index is relatively simple. It's quite different from a B-tree index and the basic idea is when we have a column that has a small number of possible values, we might be able to map those values or encode them in a bit string. So for example, here we have a table and there's an ID column and another column which is_union_member and you can see we list yes or no or null. And we could use literally those strings. Alternatively, we could map a yes to a one, a no to a zero and a null to a zero zero. And that's what we've done in the two columns on the right. Now, it doesn't have to be just two values. You can have a larger number of possible values. For example, in this new table here on the right where we have an ID and pay_type, we have three different kinds of pay type: salary, hourly, and contractor. Now, you'll notice the salary column has a one in it…

Contents