问题描述
我们正在寻找更新(重写)我们的系统,其中储存有关人们何时可以在白天预订房间等的信息。现在我们在一个表中存储开始和时间以及房间的可用日期,在另一个表中存储单独的预约时间。
We are looking at updating (rewriting) our system which stores information about when people can reserve rooms etc. during the day. Right now we store the start and time and the date the room is available in one table, and in another we store the individual appointment times.
表面上看来,这样存储信息似乎是一个逻辑的想法,但随着时间的推移和系统的负载,我们开始意识到这个数据结构似乎效率低下。 (这是一个密集的操作,搜索所有房间的可用时间,并计算什么时候可用的房间。如果房间可用于给定的时间,是可用的时间足够长,以适应所要求的时间)。
On the surface it seemed like a logical idea to store the information this way, but as time progressed and the system came under heavy load, we began to realize that this data structure appears to be inefficient. (It becomes an intensive operation to search all rooms for available times and calculate when the rooms are available. If the room is available for a given time, is the time that it is available long enough to accommodate the requested time).
我们围绕着如何使系统更有效率,我们认为有一个更好的方法来处理。有没有人有建议如何去做这个,或有什么地方可以看看如何建立这样的东西。
We have gone around in circles about how to make the system more efficient, and we feel there has to be a better way to approach this. Does anyone have suggestions about how to go about this, or have any places where to look about how to build something like this?
推荐答案
我发现这本书是鼓舞人心的,是任何种类的涉及时间管理/约束的数据库的必读:
I found this book to be inspiring and a must-read for any kind of database involving time management/constraints:
(由编辑者添加:可通过的主页在线查看。这是一本好书。)
(Added by editor: the book is available online, via the Richard Snodgrass's home page. It is a good book.)
这篇关于时间日历数据结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!