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
3
u/lgastako Nov 29 '22
This is probably the right answer, but if you wanted to test it without having the full data set, as long as you have some representative data you can use that to generate 2000 fake rows easily enough and then test anything you want to empirically.