I am looking for ways to improve performance and reduce database queries in a system I'm building. There are about 40 "value tables" which are used to populate listbox values. These represent various product attributes and are used in many scripts throught the application. Most scripts are architected to perform both page build and form process. This allows a high level of editing or re-sorting, with user entered data preserved and redisplayed (without effort via common array).
Question - to cut down database access, would it be more efficient to keep these value arrays as session data? I could either load them all, or on an "as needed" basis if a script called for an array that was not present. I am not sure of the performance tradeoff - db access for possibly a dozen tables, or maintaining about 30K of additional session data? I realize that session data is "virtual" and may end up on disk itself as the webserver manages it's memory. On the other hand, my hosting provider charges for traffic to/from the database server.
If storing "medium persistancy" data in session variables is efficient and fast (vs db io) I can expand this to more data that would ordinarily be "reobtained" in each script i.e. carry the "working set" of low volatility data.
Thanks
Chris