Performance: Why database choice affects architecture
This affects how fast data loads and how the app handles user requests, impacting overall responsiveness and scalability.
Using a NoSQL database optimized for fast reads and horizontal scaling, with proper indexing and caching
Using a relational database with complex joins for a highly scalable, real-time app without caching or indexing
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Relational DB with complex joins | N/A (server-side) | N/A | Delays paint due to slow data | [X] Bad |
| NoSQL DB with indexing and caching | N/A (server-side) | N/A | Faster paint due to quick data | [OK] Good |
const db = new NoSQLClient();
await db.insert({ id: 1, name: "Alice" });
const user = await db.find({ id: 1 });
console.log(user.name);const client = new Client();
await client.connect();
const result = await client.query('SELECT * FROM users WHERE id = $1', [1]);
console.log(result.rows[0].name);Pass the test and this pattern moves unknown