Re: Find free appointments faster
Hi,
It may be that the condition on date reduces the number of candidate rows so much that the additional savings from using the index to restrict on time_start/time_end is smaller than the overhead of more subqueries. So it might not be more to save here.
If you need to add/substract a second, you should do it to the operand that is constant not to the column since the latter prevents the use of index. However, I think you can achieve what you want without adding seconds. If you have to intervals (a,b) and (c,d), could you not say that these overlap only if
c < b <= d OR a < d <= b
I.e., intervals do not overlap when start time of one interval equals end time of the other.
Øystein Grøvlen,
Senior Principal Software Engineer,
MySQL Group, Oracle,
Trondheim, Norway
Subject
Views
Written By
Posted
3855
November 08, 2017 12:32AM
791
November 08, 2017 12:48AM
805
November 08, 2017 04:57AM
824
November 08, 2017 10:43PM
805
November 08, 2017 11:31PM
730
November 09, 2017 09:27AM
761
November 14, 2017 10:19AM
Re: Find free appointments faster
738
November 14, 2017 09:31AM
808
November 08, 2017 11:22PM