sql - MySQL work with the database contains a table with millions of rows -


i not dba guy want ask few questions.

i have 48 million rows in table, 10 columns. on 7 of these columns need run queries :

select * `table1` `flag` = '1' - 10 millions of rows (takes 2 seconds) -  on flag column have index   select * table `name` '%john%' - 10k results (takes 10h) on `name column have index  

well i'm having problems working like, need results fast without waiting 2 seconds, in case takes 10h.

i hope here me, thank guys.

mysql use index on before first wildcard (%). if wildcard first symbol of "seach-string", no index used.

http://dev.mysql.com/doc/refman/5.1/en/mysql-indexes.html

like 'john%' - fast like '%john%' - slow

i believe u should use full-text search

http://dev.mysql.com/doc/refman/5.0/en/fulltext-search.html


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -