Is it possible to create an index in mysql but the index field is a substring? For example:
Create NON-UNIQUE INDEX nombreInidice on nombreTabla (SUBSTRING(nombreCampo FROM 1 FOR 4)) USING HASH;
Is it possible to create an index in mysql but the index field is a substring? For example:
Create NON-UNIQUE INDEX nombreInidice on nombreTabla (SUBSTRING(nombreCampo FROM 1 FOR 4)) USING HASH;
Starting with MySQL 5.7.6 , you can use a auto generated column to store the sub-string you're interested in and create an index on that column, for example:
CREATE TABLE MiTabla (
id int
, MiCampo CHAR(50)
, MiSubCampo CHAR(10) AS SUBSTRING(MiCampo, 8, 10) STORED
, INDEX(MiSubCampo)
)