Employees are going to read data (a whole row) from the server through a website.
The data to be read by them, the rows, is the result of quite a few joins involving something more than 10 tables.
Question:
1. Should I create and refresh a new table containing the end-resulta data to be read so at presentation layer we just do Select top 1 from table?
2. Or should I execute a Select… and a large series of joins, multiplication, etc in order to get that one row?
I’m about to start with this and the first idea I have to admint was to build a big new table with the data, but this question popped up since I’m being carefull with normalization through tables, and building the new one would result in redundancy of data.
Have to say that the desired product is for the Employees webpage to access the data as fast as possible (this is why at first I thought about creating and refreshing a new table)
Thanks.
EDIT
about 300 (maybe 1k in the future) people is going to access the website. They will query this one row, do what they have to do with it and then hit OK so they get a new row (guess it will be 2 minutes between query and query). What we don’t want to happen is: Employees are gonna get coached all the time, and one of those coaching factors is the time they take to work on a row (client I must say). So, if the query takes too long (a matter of seconds between every refresh would be “too long” for them) then I’d have to build a new way to take this into consideration. And of course I’d prefer not to.
EDIT 2
Once they hit OK, another query triggers to update data in the DataBase, then the original query so another row is sent to the webpage.
Why does it have to be as fast as possible? If it runs in 0.1 seconds, isn’t that fast enough?
Is it because you are running the query in a loop? If so, then I suggest that you change your strategy to fetch data in bulk rather than one row at a time.
If you really do need it to be as fast as possible for whatever reason, then yes, having a precalculated result ready will be faster than making the query from the original data sources. Populating a table is one way of achieving this. Another way is to use a caching mechanism so that the request is only slow the first time, but repeated requests for the same data will be faster.
Note that either precalculating the results or using caching will increase performance, but may give you problems with stale data when the original data changes.