Erdenebayar Batsukh
Erdenebayar Batsukh

Reputation: 13

MySQL LIKE vs BOOLEAN MODE (FULLTEXT) where and when to use?

I want to search from a lot of records by name. When i use MySQL LIKE it's getting too much time to search. What if I use fulltext search match(name) against(*linebre*) IN BOOLEAN MODE on my code, will it be faster?

and i checked on my records

MySQL Like

MariaDB [****]> select count(*) from contents where tags like "%а%";
+----------+
| count(*) |
+----------+
|    16927 |
+----------+
1 row in set (0.08 sec)

FullText

MariaDB [****]> select count(*) from contents where match(tags) against('*а*' IN BOOLEAN MODE);
+----------+
| count(*) |
+----------+
|     6665 |
+----------+
1 row in set (0.06 sec)

seems like i'm using wrong on FULLTEXT search. there has a huge difference.

how can i use it? and which one is handy to use?

Upvotes: 0

Views: 243

Answers (1)

Saqib Javed
Saqib Javed

Reputation: 177

Don't know what is the requirement for a count here but you can try

select count(*) from contents where match(tags) against('а' IN BOOLEAN MODE);

hope that helps

Upvotes: 2

Related Questions