Home > database > If I have 1 million of the enterprise name, with the enterprise name like % % to query not walked sl
If I have 1 million of the enterprise name, with the enterprise name like % % to query not walked sl
Time:09-21
Ask a question, I have 1 million of the enterprise name, if the enterprise name like % % to query, is not walk index, query need to take 5 to 7 seconds at a time, if use the full-text search engine, a query result is not completely, because full text search engine is automatically split words, such as tiananmen square in Beijing, can't query, query Beijing day
After using mycat and hadoop, speed up to 2 seconds, but under 50 concurrent, don't walk the index, more than 40 seconds,
Are the solution?
CodePudding user response:
In this way, like an enterprise name % can use an index, but does not know operator does not comply with the requirements; Key, field or use the LOCATE (name) & gt; 0, try speed
CodePudding user response:
Recommended es do, at the bottom of the reverse index can solve the problem of fuzzy search, need to set up the server, there are many online es tutorial, building good index es performance must be doubled, the contents of the database synchronization to the es can be based on scene,
CodePudding user response:
1 million data is not large, as far as possible put the name field to change the length of the small (such as the actual maximum length of only 50, that is set to 80) Then try the following approach:
# 1. Create a temporary table CREATE TEMPORARY TABLE TMP (id bigint primary key);
# 2. The related data of the primary key is inserted into a temporary table, Insert into TMP (id) Select the id from TB where theName like '% % enterprise name;
# 3. The results of the query to get the actual Select * from TB as a inner join TMP as b on Anderson, d=b.i d;
# 4. Remove the temporary table Drop the TEMPORARY table TMP;
Of course, the best practices or ES.
CodePudding user response:
Upstairs, the method of affirmation or slow, still want to go to the full text search,