Replies: 1 comment 5 replies
-
Okay, so here's the problem: Both VReport and VBug are aggregates over multiple tables, because the tables are modeled after logical entities. Sorting and/or filtering by a foreign property in mysql is very slow (most of the time a filesort over all reports is triggered). My "fix" here was to only allow filtering and sorting on properties of the actual object - meaning columns in the main table being requested. A version code is not a property of bug, but of version, so we can't sort or filter by it without breaking performance. For this specific case (and probably a lot of other specific cases) I could manually construct a query that performantly builds exactly the required result, but the issue is everything has to work together with all other filters or sort orders. I have been thinking about this for a while, and the only solution I could come up with requires a paradigm shift - where tables are modeled after the view they are used for, not the entity they represent. That would result in quite a bit of data duplication though - meaning the read-effort is moved to a write-effort and consistency becomes a problem. I'm not yet sure what exactly I'm aiming for I'm very much open to alternative suggestions |
Beta Was this translation helpful? Give feedback.
-
Moving this out of commit comments:
— @mikehardy
I'm using this as a general discussion post about query optimization, including but not limited to filtering by version.
Some related discussion also happened in #324
Beta Was this translation helpful? Give feedback.
All reactions