0

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.

4

3 回答 3

1

我会先从常规视图开始,只有当我遇到性能问题时,我才会实现它(索引视图或手动创建一个新表并用数据填充它)。

于 2012-07-24T22:50:13.900 回答
1

我宁愿拥有一个规范化的数据库并运行一个可能比非规范化数据和更快的查询更昂贵的查询。我认为第二种情况可能会遇到维护/可读性问题,不仅是为了确保您的缓存表是最新的,而且必须写入该数据的所有核心逻辑以解决这些情况。

如果它被大量访问,您可能希望在检索此数据的客户端(asp.net?)上实现缓存,以防止不必要的调用。

于 2012-07-24T22:51:02.010 回答
1

不得不说,想要的产品是让员工网页尽可能快地访问数据

为什么它必须尽可能快?如果它在 0.1 秒内运行,那还不够快吗?

是因为您正在循环运行查询吗?如果是这样,那么我建议您更改策略以批量获取数据,而不是一次获取一行。

如果您出于某种原因确实需要它尽可能快,那么是的,准备好预先计算的结果将比从原始数据源进行查询要快。填充表是实现此目的的一种方法。另一种方式是使用缓存机制,使得请求只有第一次慢,但重复请求相同数据会更快。

请注意,预先计算结果或使用缓存都会提高性能,但可能会在原始数据更改时给您带来陈旧数据的问题。

于 2012-07-24T22:47:10.337 回答