Im working on a Django app, where in a user can search using a combination of parameters from 3 lists(say A, B and C). Total no. of searches possible = len(A)xlen(B)xlen(C).
For each search, a whole algorithm runs to bring data from the database, do some operations on it and finally come up with the context to be passed to the template. This takes a lot of time.
To reduce the query time, I'm thinking of creating static files (with names a+b+c), and run all queries to save the data in these files. So when the user searches for anything, instead of running the whole algo everytime, the context directly comes from these static data files.
What would be the best filetype to save this data in? Is it a good approach for reducing query time?