first_name
has one word, correct? FULLTEXT(first_name) is not a use case for that type of indexing. I recommend you use simple
INDEXes` for any simple columns.
This works very efficiently, probably faster than anything that could be done with FULLTEXT
:
WHERE last = 'Muench' AND first LIKE 'C%'
INDEX(last, first)
You might still want FULLTEXT(first, last, email, phone)
for handling the case where any of those might be entered. (However, it is unclear whether this is a good use case.)
Meanwhile, don't blindly use (255)
for all string columns; use sensible limits.
It is often wise to have the UI construct the WHERE
clause based on what the user does/doesn't supply. In your case, this might include switching between MATCH..AGAINST
, =
, and LIKE
, maybe even REGEXP
.
You could also look for @
to discover emails, all-digits to discover phones, etc., thereby avoiding searching lastname for foo@bar.com
.
As an alternative, you could add an extra column that contains all the 'words' for name, email, etc. Then have a single FULLTEXT
index on that one column; no need for 40. The drawback is the need to maintain this redundant info. With a new enough MySQL or MariaDB, it could be a 'generated' column.
Best Answer
from the MySQL doc:
Also check the Section C.10.3, “Limits on Table Size”.
Highlight for the OS limits.
And the list under "If you do encounter a full-table error, there are several reasons why it might have occurred:"