MySQL Forums
Forum List  »  Performance

Re: Find free appointments faster
Posted by: Peter Brawley
Date: November 08, 2017 11:31PM

> I add a second to a possible start (08:10:01)

Ill-advised. There's a widely used convention for handling time periods. Widely used because it works, and avoids complications like the one you introduce.

Logically a time period may be ...

- closed-closed: includes both start date and end date,

- closed-open: includes the start date, excludes the end date,

- open-closed: excludes the start date and includes the end date,

- open-open: excludes both start date and end date.

The near-universal business default is closed-open: if you book a hotel room for 22-24 May, the hotel will expect you to arrive in the afternoon of 22 May and leave in the morning of 24 May, having stayed the two days of the closed:closed period 22-23 May, or the closed:open period 22-24 May. Obviously a temporal database needs a consistent convention. The common convention is closed-open periods. Your queries will be easier to develop, debug, optimise and maintain if you follow it.

Options: ReplyQuote


Subject
Views
Written By
Posted
2985
November 08, 2017 12:32AM
539
November 08, 2017 12:48AM
541
November 08, 2017 10:43PM
Re: Find free appointments faster
550
November 08, 2017 11:31PM
477
November 09, 2017 09:27AM
495
November 14, 2017 10:19AM
542
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.