I'm working on a product page where you have a set of options which will affect the price. The main option, which is always there, lets you choose a material. Depending on the material, then, the set of option can change.
On the database I have a table listing the final products with their prices, which is a table of about 2000 rows listing every single product available with the different options.
Something like:
product_id / code / price / size / option / color
1 ABC 20$ 1 3 5
2 DEF 30$ 2 4 5
3 FFF 30$ 3 4 5
and so on.
The whole thing works with ajax calls, so everytime an option changes, I query the database, look for the product with that set of options and show the price.
Would it make sense in this specific case to get the whole list of products at the beginning (would be a single query, and about 2000 rows), store it in a Javascript object and filter it?
If it's of any importance, I'm using MySql
2000objects doesn't seem a lot. You just have to try it and even then, a machine with very little memory and a bad processor running the script in an old browser with a slow JS engine could not result in the same outcome.