-
Notifications
You must be signed in to change notification settings - Fork 82
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
Some queries from Web interface aren't using indexes requiring too much time on v3.1.3 #580
Comments
Analyze results for such query: |
This is likely above my paygrade 😅 I can reproduce on the linuxtv instance but have yet to do so locally (and even then, I'm not certain how I'd address it yet...) |
Yeah, this one seems tricky, and it generates 3 sub-queries that don't use indexes. Btw, if the query keeps having the blank fields there, like Funny enough, a query like I mean, running:
is really fast. So, IMO, the problem is how patchwork currently handle "state=*", creating this really complex query, while something a lot simpler would produce the same result while using indexes. |
Looking at the code, it sounds it comes from here:
No idea why it is trying to count patches there via such complex query, instead of just doing the query. |
I also ran into this while upgrading our FFmpeg instance from 3.0 to 3.2. I managed to reduce the issue somewhat by examining some of the most heavy-hitting queries and adding missing indices (using mariadb 11.5): ALTER TABLE `patchwork_patch` ADD INDEX `patchwork_patch_by_date` (`id`, `date`);
ALTER TABLE `patchwork_patch` ADD INDEX `patchwork_patch_by_project_and_state` (`project_id`, `state_id`);
# not entirely sure this one is needed/used
ALTER TABLE `patchwork_patch` ADD INDEX `patchwork_patch_by_date_and_project` (`project_id`, `date`, `archived`); This brought down some query times from 5-15 seconds to 0.xxx seconds. But some heavy hitters remain, even with them using indices. The core issue seems to be that even a relatively simple query like this takes 20+ seconds: SELECT
`patchwork_patch`.`id`,
`patchwork_patch`.`msgid`,
`patchwork_patch`.`date`,
`patchwork_patch`.`submitter_id`,
`patchwork_patch`.`project_id`,
`patchwork_patch`.`name`,
`patchwork_patch`.`delegate_id`,
`patchwork_patch`.`state_id`,
`patchwork_patch`.`series_id`
FROM `patchwork_patch`
WHERE `patchwork_patch`.`project_id` = 1
ORDER BY `patchwork_patch`.`date` DESC LIMIT 10 OFFSET 36300; That's purely because of the large offset. The query uses all the indices it can get. I don't think this can really be optimized. |
This query:
state=*&archive=true
Is producing a complex sql statement that it is not using indexes and are taking a long time to complete:
As reported by mysql slow log, it takes more than 1:30 mins to complete:
Issue noticed at https://patchwork.linuxtv.org.
The text was updated successfully, but these errors were encountered: