I tested Laras with 100 million rows. Here’s why it stores data by column.
Say you have five million invoice records and want to know how much customers still owe you. You need two fields to answer that question: Status and Amount . The customer names, invoice numbers, and notes can stay where they are. That example gets at one of the decisions I made while building Laras . It looks like a spreadsheet when you open it. Underneath, the core engine organizes data by…
Laras stores data column-wise, rather than row-by-row, when opened in a spreadsheet-like format. This approach groups related values together, such as statuses and amounts, to optimize query performance. For instance, when calculating the total amount owed by unpaid customers, the engine can quickly scan the "Status" column to identify unpaid invoices and sum the corresponding values in the "Amount" column. This column-oriented layout saves processing time by skipping columns that are irrelevant to the query.
Laras is written in Rust and utilizes WebAssembly to execute the Rust code within a web application. This combination allows Laras to run efficiently in browsers. By only processing necessary columns, the engine can handle extensive datasets, which was demonstrated in a test using 100 million synthetic rows.
The column layout also aids in improving browser responsiveness and minimizes resource usage when dealing with large amounts of data. For example, Airtable supports up to 500,000 records per base on Enterprise Scale, while Google Sheets relies on cells as its unit of measurement, with the ability to handle up to 20 million cells per spreadsheet. A dataset with five million rows and five columns would equate to 25 million cells.
Notion, on the other hand, offers a unique approach by allowing users to open database items as full pages. This can be particularly useful for accessing related information like meeting notes or project briefs alongside a property's details. Throughout building Laras, the primary question has been about optimizing data processing for specific queries, such as determining how much customers still owe. Laras aims to efficiently handle this and similar tasks by leveraging a column-oriented layout.
Rewritten by urgent.news; may contain errors — check the original.
Source: dev.to