I have the following mysql query:
EXPLAIN
SELECT
id,
name,
title,
description,
time
FROM entity
WHERE
(date_end > CURRENT_DATE
OR (date_end = CURRENT_DATE AND time_end >= CURRENT_TIME)
)
AND (next_date < CURRENT_DATE
OR (next_date = CURRENT_DATE AND next_time <= CURRENT_TIME)
)
When can I do to make this query take less time when handling 10000+ rows in the table?
Showing/Analyzing explain plan will help more to answer.
although I guess adding composite index on
[date_end, time_end]and[next_date,next_time]might help