4 ms·
Note: If you're using SQLite as your production database, N+1 queries are generally not a problem [1]. This is because queries are just a function call and don'
by infamia 4y ago
Note: If you're using SQLite as your production database, N+1 queries are generally not a problem [1]. This is because queries are just a function call and don't involve any messaging round trip to a server (i.e., they're very low latency since there is no server). This makes most N+1 queries so fast, there isn't a difference worth noticing. The only caveat is if you're pulling large amounts of data (e.g., binary blobs) off the disk or something really big/complicated in your loop; otherwise it typically shouldn't be of any concern.
[1] https://sqlite.org/np1queryprob.html https://sqlite.org/np1queryprob.html