Bug #22959
closedt3lib_db->listQuery() performance
0%
Description
The function listQuery() uses a a like-construct to find a value in a comma-seperated list.
Mysql has a internal function for this called 'find_in_set'
This is 2.5 times faster.
Enclosed the performance check script and the patch.
(issue imported from #M14818)
Files
Updated by Georg Ringer over 14 years ago
problem is, that this only works in mysql
Updated by Caspar Stuebs over 14 years ago
That's right. But for any other db you have to use dbal ...
Updated by Xavier Perseguers over 14 years ago
First of all, thanks Georg for having set the link with the feature request I just created in DBAL bugtracker.
Patch there for core adds support for FIND_IN_SET in t3lib_sqlparser.
I like the patch Caspar provided but I guess it's not needed at all as it involves using listQuery() each time we need to query such fields. Instead, I prefer simply use FIND_IN_SET in all queries and rewrite it completely in DBAL when needed, this way there's not yet another special API in t3lib_db ;-)
As there's at least one place in Core where the LIKE statement is hardcoded to query usergroups, I'll come with a patch to use FIND_IN_SET instead for this bug so don't close it in any way.
Updated by Xavier Perseguers over 14 years ago
Actually I was too quick... your patch makes sense as it is already official. I'm adding support for FIND_IN_SET anyway but your patch for Core looks great. We should simply keep the t3lib_db_listQuery_performance.patch patch and not apply the one for DBAL and all should work well I guess.
Updated by Caspar Stuebs over 14 years ago
but why do you won't add the path for the dbal?
if anyone uses the listQuery function in an extension and is using another db then mysql, the function has to be in dbal with the like statement to be sure that the function will work ...
Updated by Caspar Stuebs over 14 years ago
I have created a new patch with changed function and an InvalidArgumentException.
Updated by Xavier Perseguers over 14 years ago
Committed to:
- Core trunk (rev. 8197)
- DBAL trunk (rev. 35747)