Uid: user id, primary keys,
Datas: recommended relationship, data format, such as, 0,1,2,3,4,5,6, -- -- -- -- -- - n, each number represents a user id,
Above, is the first comma to separate two fields,
For example, I want to inquire the data of the field datas contain 2366,
There are many kinds of methods, such as the like left substring, etc., I would like to ask, also don't have what kind of the most fast way, or can be used to the index,,
CodePudding user response:
Index lookup is used less than, can't make a range according to your values orientation, need to scan all the data, so the index scan can be used, but you only have two fields, there is no difference between index scans and table scan, so is thisIf the efficiency, the second field should be stored in after the break-up, each value a record, so as to really use the index
CodePudding user response:
For relational database, model 1 for each information item not points, so although can make use of the LIKE XXXX % % to query the eligible fields, but because of your design violates the F1 query efficiency is not high, so if that is the only design your tables and fields, so it is recommended to use MySQL FULLTEXT create a full-text index,CodePudding user response:
You can try to establish a full-text indexCodePudding user response:
If you want to improve the query speed, now your table design is not reasonable, should do more than one user and user of a relational table, and a property only to save a user ID, so that you can use the index query, efficiency is naturally rapid rise;CodePudding user response:
Establish a full-text indexCodePudding user response:
With a full index have a try