Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize queries #7

Open
ywarnier opened this issue Sep 21, 2021 · 0 comments
Open

Optimize queries #7

ywarnier opened this issue Sep 21, 2021 · 0 comments
Assignees

Comments

@ywarnier
Copy link
Member

Right now we do most time-related queries with this structure:
SELECT count(down_id) FROM track_e_downloads WHERE DATE_ADD(down_date, INTERVAL 5 MINUTE) >= '2021-09-21 20:50:02';

This seems to be very difficult for MySQL to optimize (not able to use an index on track_e_downoads.down_date, for example).

It looks like a first pre-query to get DATE_ADD() in a string and then just comparing the date string to down_date straight would be enough.

@ywarnier ywarnier self-assigned this Sep 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant