- Issue created by @Pawelgorski87
15:30 14:41 Running- @pawelgorski87 opened merge request.
11:51 11:41 Running11:30 8:19 Running11:30 10:18 Running- Status changed to Needs work
almost 2 years ago 4:45pm 25 May 2023 - πΊπΈUnited States smustgrave
Thank you for reporting.
Can you confirm if this is a D10 problem as well? If so will need a patch that applies to 11.x (Which is the master branch essentially now).
Will also need a test case showing the bug
Thanks.
- Status changed to Needs review
about 1 year ago 11:32pm 8 February 2024 - Issue was unassigned.
- π΅π±Poland Pawelgorski87
@smustgrave Sorry, I forgot about that issue, yes it affected all Drupals, select without alias genere 'small' syntax error, sql will handle that but lose performance. Tested on big table grands with +30k items.
PR is ready - π¨π¦Canada Charlie ChX Negyesi πCanada
If it is a performance issue could you perhaps grab the queries and post them with an EXPLAIN? Thanks!
- π΅π±Poland Pawelgorski87
This is example raw query when you don't add alias in $query->select('node_access'), there is 2x node_access
SELECT 1 AS "expression" FROM "node_access" "node_access" WHERE ("grant_view" >= '1') AND ((("nid" = '22487') AND ("langcode" = 'pl')) OR ("nid" = '0')) AND ((("gid" IN ('0')) AND ("realm" = 'all')) OR (("gid" IN ('2'));
Repeating table names 2x is a syntax error, and SQL must process it. With small queries, it's not noticeable, but we had a lot of users where grants were being generated for about 6000-8000 users at once. Without this change, the MySQL server would crash as it couldn't process the queries. Adding an alias in the code generated the correct syntax, and the problem disappeared.
Not sure it it relevant but i did some small test on small query and there is 0.0001s diffs between queries. (screen)
- πΊπΈUnited States smustgrave
Not super verse in it but #9 mentions running EXPLAIN on the two to compare
- Status changed to Needs work
about 1 year ago 2:54pm 23 February 2024 - πΊπΈUnited States smustgrave
For #9
Leaving tests tag in case it is determined we will need tests.