Reputation: 1291
Recently I tried without successes asking MySQL DB for specific data:
SELECT code, txt_gb, txt_de
FROM table
WHERE code REGEXP 'chol'
OR txt_gb REGEXP 'chol'
OR txt_de REGEXP 'chol'
ORDER BY code
COLLATE utf8_unicode_ci
I read somewhere that LIKE command has better performance that REGEXP. Is it true? Can I use LIKE in this case instead of REGEXP to find a part of cell? I am very interested in minimizing the load on the DB.
Upvotes: 0
Views: 55
Reputation: 2192
try
SELECT code, txt_gb, txt_de FROM table WHERE code like '%chol%' OR txt_gb like '%chol%' OR txt_de like '%chol%' ORDER BY code
yes Regex is slow at time, like is not faster even, but works well and easy to write then regex for your need.
Upvotes: 1