[TYPO3-core] RFC #14818: Performance: Use mysql find_in_set-function in t3lib_db->listQuery()

Ries van Twisk typo3 at rvt.dds.nl
Sun Jul 4 03:33:28 CEST 2010






> I forgot to attach the patch, sorry
>
>> This is an SVN patch request.
>>
>> Type: Performance
>>
>> Bugtracker references:
>> http://bugs.typo3.org/view.php?id=14818
>>
>> Branches:
>> Trunk
>>
>> Problem:
>> The function listQuery() uses 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.
>>
>> Solution:
>> change the t3lib_db->listQuery(), using the mysql-function  
>> find_in_set
>> instead of the like-construct.
>> adding the funcion listQuery() to the dbal ux_t3lib_db class with the
>> like-construct.
>>
>> Greetings
>> Caspar

Casper,

I had a small discussion with Xavier this morning about
a find_in_set compatible function for PostgreSQL.

Is it possible that the functions get's changed to :

$where = 'find_in_set(\'' . $pattern . '\',' . $field . ') != 0';

The rationale behind this is that it's easer to port
this function to other databases because for example
PostgreSQL 'wants' a boolean evaluation, and mysql
fakes integer for boolean, a bit like what PHP does (incorect IMHO).
It's also to show other people reading the code the correct way to do  
it.

However, I leave the final decision up to you and Xavier (or others).

Ries




More information about the TYPO3-team-core mailing list