[TYPO3-english] Slow Queries From TT-News
Xavier Perseguers
xavier at typo3.org
Mon Nov 14 23:49:03 CET 2011
Hi Georg,
> yeah but how to select then records with 20 pids set, this needs to be a
> FIND_IN_SET or IN(), no matter if inside a join or not, right?
You use an IN(), yes, no problem (I found once that number of items
within IN is limited in some DBMS. In Oracle 10 for instance IIRC it is
1000. Then you have to split your list into something like
column IN (i1, i2, i3, ... i1000) OR column IN (i1001, ...)
Regarding FIND_IN_SET, Jigal is right, the aforementioned query should
in fact be written using FIND_IN_SET and not the LIKE construct for
MySQL but anyway, it is prettier but even without number at hand I
really fear it is not quicker than the LIKE statements because basically
the only method to properly search that is having full text search
capability, something that allows special indices to be built where the
string is tokenized in reverse order as well to let the % be placed at
the beginning as well.
If you have the possibility to use a real relation, do it without
hesitation! And do not forget to add CREATE INDEX statements, basically
as a rule of thumb, for all your foreign keys.
Regards
--
Xavier Perseguers
Release Manager TYPO3 4.6
TYPO3 .... inspiring people to share!
Get involved: http://typo3.org
More information about the TYPO3-english
mailing list