<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Database | Jacob Aloysious</title><link>https://jacobaloysious.in/tag/database/</link><atom:link href="https://jacobaloysious.in/tag/database/index.xml" rel="self" type="application/rss+xml"/><description>Database</description><generator>Source Themes Academic (https://sourcethemes.com/academic/)</generator><language>en-us</language><lastBuildDate>Sat, 10 Jul 2021 00:00:00 +0000</lastBuildDate><image><url>https://jacobaloysious.in/images/icon_hu4591c05f594249c11c1e99a3a8f1f246_3759739_512x512_fill_lanczos_center_2.png</url><title>Database</title><link>https://jacobaloysious.in/tag/database/</link></image><item><title>Bitmap Indexed Storage</title><link>https://jacobaloysious.in/post/tech_bitmaped_indexed_storage/</link><pubDate>Sat, 10 Jul 2021 00:00:00 +0000</pubDate><guid>https://jacobaloysious.in/post/tech_bitmaped_indexed_storage/</guid><description>&lt;p>Always been facinated by the ways - data structure&amp;rsquo;s can enable better storage and faster queries.&lt;/p>
&lt;p>BitMapped Indexed Storage - is useful while using &lt;strong>Columnar Databases&lt;/strong> - where per column data is stored together.&lt;/p>
&lt;p>Often the number of &lt;strong>distinct&lt;/strong> values in a column is small compared to the total number of rows. In the below example: column &lt;em>sex&lt;/em> there are only two distinct value &lt;em>Female or Male&lt;/em> in the given table - the cardinality is really low.&lt;/p>
&lt;p>In such cases: We can now take a column with &lt;em>n&lt;/em> distinct values and turn it into &lt;em>n&lt;/em> separate bitmaps: one bitmap for each distinct value, with one bit for each row. The bit is 1 if the row has that value, and 0 if not.&lt;/p>
&lt;p>Picture is worth a thousand words.. here we you go..&lt;/p>
&lt;p>&lt;img src="dbimage.jpg" alt="alt Components" title="Work">&lt;/p>
&lt;p>Fantastic Query performance&amp;hellip; As the amount of data read from disk on to the memory is less - improved Disk Throughput.
As always, solution are for a specific problem. If you wanna do a range query, then this solution might not the best.&lt;/p>
&lt;p>If &lt;em>n&lt;/em> is very small, those bitmaps can be stored with one bit per row. But if &lt;em>n&lt;/em> is bigger, there will be a lot of zeros in most of the bitmaps (&lt;em>sparse&lt;/em>). In that case, the bitmaps can additionally be run-length encoded or might not be recommened.&lt;/p>
&lt;p>Reference:
&lt;a href="https://www.goodreads.com/book/show/23463279-designing-data-intensive-applications" target="_blank" rel="noopener">Designing Data-Intensive Applications, by Martin Kleppmann &lt;/a>&lt;/p></description></item></channel></rss>