Bug #22959
closed
t3lib_db->listQuery() performance
Added by Caspar Stuebs over 14 years ago.
Updated about 6 years ago.
Category:
Database API (Doctrine DBAL)
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
problem is, that this only works in mysql
That's right. But for any other db you have to use dbal ...
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.
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.
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 ...
I have created a new patch with changed function and an InvalidArgumentException.
Committed to:
- Core trunk (rev. 8197)
- DBAL trunk (rev. 35747)
- Status changed from Resolved to Closed
Also available in: Atom
PDF