FULLTEXT
only applies to string datatypes, such as VARCHAR
and TEXT
. After all, it is looking for "words".
The charset/collation of a table is only the default for newly added columns.
You can ALTER TABLE ... CONVERT TO ...
to change all the columns in a table. But before doing so, tell us why you are doing it and whether there is already non-English text anywhere in table. Using that ALTER
may just make things worse.
What, in particular, are you searching for in the DATETIME
? It may be possible to change to a 'range' query that may run efficiently with an index. Let's see the attempted query and SHOW CREATE TABLE
.
More
WHERE created = '2018-01-11 20:49:01'
will check for a specific second
or
WHERE created >= '2018-01-11'
AND created < '2018-01-11' + INTERVAL 1 DAY
will check for any created
in a specific day.
Etc.
Either of these examples may use an INDEX
(not FULLTEXT
) containing created
. I say "may" because there could be other issues. Please provide the SELECT
and SHOW CREATE TABLE
.
(The API, such as mysqli
, is not relevant to the question.)
Still More
Looking at this formulation...
SELECT symbol,created
FROM products
WHERE symbol='".$ccc['symbol']."'
AND created LIKE '%".$date_format."%'
ORDER BY id DESC
limit 0,48
I see that INDEX(symbol)
is likely to be helpful, but nothing having to do with created
is useful. This is because of the leading wildcard on the LIKE
, and because an index won't be used with a DATETIME
and LIKE
. The way to get performance via an index is as discussed above (using a range).