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

Slow queries which need to be fixed #1873

Closed
peppy opened this issue Dec 1, 2017 · 8 comments · Fixed by #2037 or #2069
Closed

Slow queries which need to be fixed #1873

peppy opened this issue Dec 1, 2017 · 8 comments · Fixed by #2037 or #2069

Comments

@peppy
Copy link
Sponsor Member

peppy commented Dec 1, 2017

SELECT `user_id`, `beatmap_id`, `score`, `rank` FROM `osu_scores_high` WHERE `user_id` = 3172980

@peppy
Copy link
Sponsor Member Author

peppy commented Dec 1, 2017

select * from `osu_user_stats_fruits` where exists (select * from `phpbb_users` where `osu_user_stats_fruits`.`user_id` = `phpbb_users`.`user_id` and (`user_warnings` = 0 and `user_type` = 0)) and `country_acronym` = 'TR' order by `ranked_score` desc limit 50 offset 500

@peppy
Copy link
Sponsor Member Author

peppy commented Dec 1, 2017

select * from `osu_user_stats_mania` where exists (select * from `phpbb_users` where `osu_user_stats_mania`.`user_id` = `phpbb_users`.`user_id` and (`user_warnings` = 0 and `user_type` = 0)) and `country_acronym` = 'VE' order by `rank_score` desc limit 50 offset 9150

@peppy
Copy link
Sponsor Member Author

peppy commented Dec 1, 2017

select min(`post_id`) as aggregate from `phpbb_posts` where `phpbb_posts`.`topic_id` = 134389 and `phpbb_posts`.`topic_id` is not null and `phpbb_posts`.`deleted_at` is null

@peppy peppy changed the title Query retrieving 60k+ rows Query retrieving 60k+ rows and/or taking longer than 30 seconds (!) to execute Dec 1, 2017
@peppy
Copy link
Sponsor Member Author

peppy commented Dec 1, 2017

SELECT count(*) AS AGGREGATE FROM `phpbb_zebra` WHERE `zebra_id` = 18983 AND `friend` = 1 (index on (zebra_id, friend) will help a bit) index added

@peppy
Copy link
Sponsor Member Author

peppy commented Dec 1, 2017

select * from `osu_user_stats_fruits` where exists (select * from `phpbb_users` where `osu_user_stats_fruits`.`user_id` = `phpbb_users`.`user_id` and (`user_warnings` = 0 and `user_type` = 0)) and `country_acronym` = 'VN' order by `ranked_score` desc limit 50 offset 9700 many queries hitting the non-optimised end of ranking pages (googlebot?)

@peppy
Copy link
Sponsor Member Author

peppy commented Dec 1, 2017

select * from `osu_user_stats_fruits` where exists (select * from `phpbb_users` where `osu_user_stats_fruits`.`user_id` = `phpbb_users`.`user_id` and (`user_warnings` = 0 and `user_type` = 0)) and `country_acronym` = 'NO' order by `ranked_score` desc limit 50 offset 550

@peppy
Copy link
Sponsor Member Author

peppy commented Dec 2, 2017

select count(*) as aggregate from `osu_scores_high` where `user_id` = 5287410 and `pp` > (select `pp` from `osu_scores_high` where `score_id` = 2416055216)

@peppy peppy changed the title Query retrieving 60k+ rows and/or taking longer than 30 seconds (!) to execute Slow queries which need to be fixed Dec 2, 2017
@peppy
Copy link
Sponsor Member Author

peppy commented Dec 6, 2017

Friends lookups resolved via adding of index.

notbakaneko added a commit to notbakaneko/osu-web that referenced this issue Dec 19, 2017
Apparently, mysql is fetching all the matching rows before applying min
>_>
notbakaneko added a commit to notbakaneko/osu-web that referenced this issue Dec 19, 2017
Apparently, mysql is fetching all the matching rows before applying min
>_>
@nanaya nanaya reopened this Dec 19, 2017
notbakaneko added a commit to notbakaneko/osu-web that referenced this issue Dec 20, 2017
Adds a new index and drops the old one.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants