I have to look up prices depending on 1 value in my database. The database table contains 40000 entries with id, name, minvalue, maxvalue, price. I look up the correct price for value 2 with e.g.
SELECT name, price FROM priceTable WHERE minvalue <= 2 AND maxvalue >= 2;
Because i have to look up many prices (10000 and more) i thought about using something like a HashMap, with all the table data inside, so I would only have 1 database request and the rest would be done locally.
Has anyone experience with this? Is it possible to "convert" the SQL-request into a efficient HashMap-lookup? I cannot use the value as keys to look up, because e.g. the matching entry for the example above has minvalue 1 and maxvalue 3. So there would not be a key "2".