I have a system that searches for company. I want that when a user searches for \"Demo\", all records that have \"Demo\" will be returned, like \"The Demo\", \"Demo Inc.\",
I dont see why 1M is a problem I just tested on my laptop MySQL MyISAM that has also a company but it is 250K rows and it took 3.3 ms , and the field is not indexed. can you try folowing
$search='Demo';
$regex="/\b$search\b/i";
$sql = "select * from table where company like '%$search%';
//... get the results
foreach($results as $companyName){
if(preg_match($regex,$companyName,$match)){
//here you got a match
}
}