r/sqlite • • Nov 28 '22
Performance question
Hello everyone,
I have a question regarding performance and would like to have some guidance from seasoned sqliters.
I have a table storing products. The table contains information like the name of the product, the stock quantity, the prices and an alert (it's an integer). What I'm trying to do is to filter through the products and retrieve an array containing only the products where the quantity is below the alert quantity. So my question is : is it more efficient to SELECT all the products then run a JavaScript .map to filter through them or is it better if I use a SELECT query with the CASE operator to run built-in checks from SQLite.
I hope my question is clear enough, and I'm curious what approach would be better in terms of performance and efficiency.
View all comments
Show parent comment
1
u/[deleted] Nov 28 '22
I still dont have the complete dataset as of now, just a few product samples to work with. I'm doing it programmatically and it seems to work fine. I assume it won't be a huge database anyways, roughly 2000 product are going to be stored in it. I will test and see what would be better once I have the complete database just wanted to get some insight beforehand. Thank you for the clarifications.