Hi everyone,I’m working on a list in Community Builder using the following filter condition:
Code:
(ue.`cb_membertype` LIKE '%Gryffindor%' OR ue.`cb_membertype` LIKE '%Hufflepuff%' OR ue.`cb_membertype` LIKE '%Ravenclaw%' OR ue.`cb_membertype` LIKE '%Slytherin%' OR ue.`cb_membertype` LIKE '%Prefect%') AND ue.`cb_privacy` = '0'
The issue is that the list takes a bit of time to load, possibly due to the use of multiple
LIKE conditions. To optimize it, I’m considering replacing these
LIKE statements with an
IN condition, like this:
Code:
ue.`cb_membertype` IN ('Gryffindor', 'Hufflepuff', 'Ravenclaw', 'Slytherin', 'Prefect') AND ue.`cb_privacy` = '0'
If the
cb_membertype values are consistent and don’t require partial matching, this could potentially speed things up.Alternatively, if partial matches are necessary, I’ve adjusted the
LIKE conditions to avoid
% at the beginning:
Code:
(ue.`cb_membertype` LIKE 'Gryffindor%'
OR ue.`cb_membertype` LIKE 'Hufflepuff%'
OR ue.`cb_membertype` LIKE 'Ravenclaw%'
OR ue.`cb_membertype` LIKE 'Slytherin%'
OR ue.`cb_membertype` LIKE 'Prefect%')
AND ue.`cb_privacy` = '0'
Does anyone have experience with a similar optimization? Do you think using
IN instead of multiple
LIKE statements is a good approach in Community Builder?Thanks for your insights!