Link to video [Found this video very important, covers Bloom Filters]

Optimize writes in a database. Scaling this. Think of DB as a data structure. B+ Tree.

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/fc2ad9d2-c9e2-4ff5-b945-bc24a8b53470/73214F10-A551-42A3-AAF2-A132CB545371_4_5005_c.jpeg

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/5605b838-d1fc-488a-9b7f-886ef813abc0/944B3825-DA2A-41F5-9FF9-E7A593725027_4_5005_c.jpeg

For scaling our database we want to :

Some ideas to do this :

  1. Condense data queries into a single query.
  2. In Linked List, write operations are efficient. So use logs. But in logs read operations are very slow. So, whatever information you get from the client, you sort it and then persist it so that reads are super fast.

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/5354e3b5-df16-4233-8275-0c7d9e6a9bdf/EB8D43B2-38FB-416F-9EAF-D82D002AE9E4_4_5005_c.jpeg

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/db0a6c44-ef6d-4c71-a7c3-a813cc4f6163/7D2DE67A-01FA-4041-B557-54C2C80C9404_4_5005_c.jpeg

Instead of sorting in the DB, keep sorted chunks.

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/8a148f7d-6766-4980-9b18-16b26c79228f/8A332275-EDBA-4D1D-8CCC-DCC3E1F289AC.jpeg

Read operation is spread across blocks. So, we can speed this up using something called Bloom filters.

Bloom filters explained