Bifalgorithm post
Let's go over how a database reads from storage. For the following query, you expect the result as a row representing the data. To generate the response, a lot has happened. A database does not have access to the data directly. The data is in storage. The data is organized across multiple fixed-size blocks, also known as pages. And each page can contain data for multiple rows stored in a binary representation. The database engine first has to figure out which page it needs. A database engine can either use an index or perform a table scan. The index provides a page reference that points to the page in storage that contains the data needed. The page is loaded into memory and the database converts the binary representation into structure data using its knowledge about the table structure. It can then extract the specific rows and needs. For the case where the database engine cannot use the index, it requires a full table scan. The database will have to load page by page into memory. Each page is converted into a structured data, and then the database iterates over each row until it finds the ones that match the query filters.
Let's go over how a database reads from storage. For the following query, you expect the result as a row representing the data. To generate the response, a lot…
Ideas in this flowchart
- Database Read Process
- Data Organization
- Data in Storage
- Pages and Rows
- Database Engine Operations
- Page Identification
- Using Index
- Table Scan
- Data Conversion
- Binary to Structured Data
- Row Extraction