mysql에서 자동 완성 (> 1M 레코드)에 사용할 대형 데이터 세트가 있습니다. 예를 들어 내가 "메탄올"을 입력하고 선행 입력 제안을 걸려으로 대용량 텍스트 데이터 세트에서 왼쪽으로 가중치가 빠른 검색 - Mysql
..현재 내가 가진
이 멋지게 일을하지만, 느린 비트입니다select AgentReferenceName as name
from tblAgentReference
where AgentReferenceName like '%methan%'
order by instr(AgentReferenceName,'methan'), char_length(AgentReferenceName)
limit 10;
+-------------+
| name |
+-------------+
| Methan |
| Methane |
| Methane |
| Methane |
| Methanal |
| Methanol |
| Methanol |
| Methanide |
| Methanamine |
| Methanamine |
+-------------+
10 rows in set (3.52 sec)
필드에 전체 텍스트 색인이 있지만 일반적인 전체 텍스트 가중 검색을 실행할 때 큰 단어가 부풀어 오릅니다.
select AgentReferenceName as name from tblAgentReference where match(AgentReferenceName) against ('methano*' in boolean mode) order by match(AgentReferenceName) against ('methano*') limit 10;
+----------------------------------------------------------------------------------------------------------+
| name |
+----------------------------------------------------------------------------------------------------------+
| 2,4-Methanoacridin-9-amine, 8-fluoro-1,2,3,4-tetrahydro-, 2-hydroxy-1,2,3-propanetricarboxylate (3:2) |
| 9-Amino-8-fluoro-1,2,3,4-tetrahydro-2,4-methanoacridine |
| 9-Amino-8-fluoro-1,2,3,4-tetrahydro-2,4-methanoacridine |
| 2,4-Methanoadamantane |
| 2,4-Methanoadamantane |
| 2-Amino-4,5-methanoadipate |
| 1,4-Methanoanthra(2,3-c)oxepin-7,12-dione, 1,3,4,5-tetrahydro-4,6,13-trihydroxy-3,11-dimethoxy-3-methyl- |
| 1,4-Methanoanthracene-9,10-dione, 1,2,3,4-tetrahydro- |
| 1,4-Methanoanthracene-9,10-dione, 1,2,3,4-tetrahydro- |
| 1,4-Methanoanthracene-9,10-dione, 1,2,3,4,4a,9a-hexahydro- |
+----------------------------------------------------------------------------------------------------------+
10 rows in set (0.13 sec)
그래서 속도는 훌륭하지만 결과는 끔찍
내 질문 - 어떻게 전체 텍스트 하나의 속도에 가깝게 등 쿼리와 유사한 반환하지만 빠른 검색을 수행하려면?
tblAgentReference에서 이름으로 AgentReferenceName을 선택하려고합니다 (부울 모드의 'methano *')와 일치하고 (AgentReferenceName, 'methan') limit 10 인 AgentReferenceName LIKE 'methano %'순서 10; 나에게 1.17 초의 훨씬 빠른 검색을 주었다 - 나는 내가 이것과 함께 잠시 동안 갈 것이라고 생각한다. 나는 나중에 추가적인 열을 시도 할 것이다. –