哪个更好? 将结果存储在Session或重新查询数据库?

I have a Quiz Website build using Codeigniter and MySQL.

Quiz evaluated using these two methods.

  1. Sending request each time user submit the Answer.(10 Database Queries for 10 Question).
  2. Sending request at end of Quiz. (That would require a Query and a lot of Calculation for searching the Answer from the Resulted array.)

I'm thinking to stored the temporary(until quiz is not submitted) Data in Session.

note: Stored data is not a directly fetched result from database but it is a processed Array using PHP before sending it to View

by doing so i can save 10 Queries in first case.
In second Case it saves me a db query and time to process the Database result.

It was the best solution i got until i read these few Questions on Stackoverflow

Question 1 Question 2 Question 3

Basic Idea that got from the above Questions is to Use database Query (because of KISS rule, might return stale data).

yes it will be eating up lot of disk space but i think at the same it is increasing performance of website.

So My Question is that:
1. Which is better Idea "to Store Calculated Result" or "Re Query then Calculate the Result"?
2. How the Session will impact the Performance of the Website?

What is "better" really depends on how you want the site to perform. Do you want partially finished quiz data to be forgotten if the user session is lost for any reason?

Generally speaking, don't concern yourself with "how many queries it's going to take", at least not for this specific problem (particularly since you're probably storing session-related data in the DB anyway), concern yourself with "what makes the most sense."

You're going round trip to the DB at least once (and probably a few times) with each page request anyway, one additional query to insert/update a row that is properly indexed isn't going to be a problem. Losing the results of someone's quiz when their browser craps out or they lose their session in some way (your fault or theirs) is probably something you want to be more interested in avoiding.

In short: You haven't provided a very compelling reason NOT to store user answers in the DB, and there are probably dozens (if not more) good reasons to not rely on the user's session for this.

Edited to add: Remember, the database's job is very simple: To store data. Use it for what it's intended for. ;)