What is FIND_IN_SET() performance like? It it something that should be avoided at all costs? I want to search a column that consists of comma-delimited numbers for rows that contain a specific number.
Dani
4,084
The Queen of DaniWeb
Administrator
Featured Poster
Premium Member
Recommended Answers
Jump to PostFIND_IN_SET() does not use indexes, so it can become slow. You can try with a regular expression and LIKE:
SELECT `column` FROM `table` WHERE `column` LIKE '123%' AND `column` RLIKE '123[0-9]{0,3}';
See this post for more information:
Jump to PostIt sounds like you aren't working to the strengths of the database. MySQL, unlike Oracle, PostgreSQL etc doesn't support arrays, and searching on text is unlikely to be optimal.
I don't know the …
All 6 Replies
cereal
1,524
Nearly a Senior Poster
Featured Poster
Dani
4,084
The Queen of DaniWeb
Administrator
Featured Poster
Premium Member
cereal
1,524
Nearly a Senior Poster
Featured Poster
Dani
4,084
The Queen of DaniWeb
Administrator
Featured Poster
Premium Member
Васил
0
Newbie Poster
pty
882
Posting Pro
cereal
commented:
nice explanation, thanks for sharing!
+14
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.