MySQL Forums
Forum List  »  Performance

Re: Find free appointments faster
Posted by: Bingo Bongo
Date: November 09, 2017 09:27AM

Hi Peter Brawley,

thank you for your help, but I have some difficulties understanding the practical significance of these conventions with regard to my application.

According to your statements the common (and recommended) convention is "closed-open", which means the interval is half-open in the mathematical sense and includes its startpoint, but not its endpoint. So my very first idea would be to store the end of the interval by subtracting a smaller unit from the endtime, because I'm not aware of any brackets or parentheses like on paper in my schooldays:
08:00:00 - 08:09:59
08:10:00 - 08:19:59
But then I would have to "transform" the end of the interval every time I display appointments in my application - of course there may exist suitable callbacks in MVC applications to transform the data after reading it in the model and before sending it to the controller, or we can create a custom function for this. I just read and display start and end of the appointment far more frequently than calculating with its interval. Are there practical reasons why one would use overlapping times just as with e.g. consciously denormalizing data in rare cases? I really don't want to defend my approach and belive you that its unfavourable - i just want to understand if there are exceptional cases.

Another idea would be to add a second to the starttime of the appointment instead of subtract it:
08:00:01 - 08:10:00
08:10:01 - 08:20:00
This way I would just need to "cut of" the seconds, which I would do anyway when showing the appointments to users.
I think both ideas would necessitate equivalent changes to openingtimes and blockingtimes, and the second idea may even necessitate changes to timeslots.
So, is one of my ideas in accordance with the widely used convention for handling time periods?

Many thanks and best regards

Options: ReplyQuote

Written By
November 08, 2017 12:32AM
November 08, 2017 12:48AM
November 08, 2017 10:43PM
November 08, 2017 11:31PM
Re: Find free appointments faster
November 09, 2017 09:27AM
November 14, 2017 10:19AM
November 08, 2017 11:22PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.