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
4009
November 08, 2017 12:32AM
836
November 08, 2017 12:48AM
836
November 08, 2017 04:57AM
867
November 08, 2017 10:43PM
850
November 08, 2017 11:31PM
776
November 09, 2017 09:27AM
802
November 14, 2017 10:19AM
Re: Find free appointments faster
774
November 14, 2017 09:31AM
836
November 08, 2017 11:22PM