Skip to content

[Onyx Audit] Inefficient DB operations #71203

@fabioh8010

Description

@fabioh8010

Overview

This issue is part of our current effort to audit the performance and scalability of Onyx.

During the Step 1: Objective Analysis we gathered a list of Perceived Problems we have exclusively about Onyx, that is, the problems in Onyx we imagine or have some evidences that that are pain points / performance bottenecks to Onyx, but we need more analysis to confirm if they really are and, if so, how much of a problem they are currently.

The main goal right now is to deep dive into each Perceived Problem, investigate/audit it and come up with findings, which we will use for the next discussions.

Problem

At the moment we use SQLite (react-native-nitro-sqlite) in native platforms and LocalStorage (idb-keyval) in web to store user's data. In both providers, all data is stored in one table as key-value pairs. In the Native provider we use SQL operations to read/write data, but we noticed that they don't seem too much performant. For example, we measured in the past that a simple setItem() operation was taking longer than multiMerge()/mergeItem() even for simple objects, which seem contradictory as we are literally asking DB to fully replace that object and it is somehow slower than doing a merge operation.

Additionally, we don't have means to measure them automatically with unit/Reassure tests, so it's difficult to know if they are working as expected, how they are performing and if these providers need improvements or not.

Action Items

  1. Audit the two providers and measure how they performing in each one of their operations.
  2. Research if it's possible to create automated tests for them.

Relevant Links

Step 1 Canvas: https://expensify.slack.com/docs/T02P6RS2ZK7/F09B668M1MG

Slack thread: https://expensify.slack.com/archives/C05LX9D6E07/p1757416490706049

Metadata

Metadata

Labels

Type

No type

Projects

Status

HIGH

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions