The problem is as follows:
Assume that the information is stored in the mysql database. As shown in the following figure, the information heap of Table A is A million-level information heap (each piece of information is not long and generally 20 characters long and is A short word ), B is a common message (about 500 characters in length, which of the following is the most effective way to determine whether B contains information in heap A and return the information contained?
A solution is provided here. If you have a better solution, you are welcome to leave a message!
Because the data volume of information heap A is large and stored in the database, A simple solution is generated, which is directly solved by an SQL statement. Of course, this will lead to A problem that is SQL optimization, how to Reduce the search time depends on your own optimization methods. The query SQL statement is as follows: select GROUP_CONCAT (matching table field) content from table name where instr (B table information, matching table field)> 0
In addition, you can use full-text retrieval to increase the search speed.