Re:Understanding N + 1 queries problem
by drowsspa on Monday January 02, 2023 @03:21PM
(#34223121)
You're still trading O(1) by O(N)... SQLite still has to read from the disk, it's still multiple orders of magnitude more expensive than a memory lookup.
[ Parent
| on HN ]
On the one hand the individual reads will result in less blocking of write operations. On the other the read consistency behavior of the system changes by interlacing writes into the middle of your query.
You can cache the database or part of it in memory.
Honestly, these workarounds to avoid doing a better architecture or to mask algorithmic complexity just come back around you to byte you.