mysql - How to speed up a selection of a subset of data in MariaDB -


i have huge table lots of data in (170gb compressed size, 3.8 million rows) , wanna select subset of data.

this subset defined list of uris. column uris in table has hash index on it.

so simple query be

select * mytable uri in ("uri1","uri2","uri") 

but query incredibly slow. 190 uris lasts on 6 hours

query ok, 240777 rows affected (6 hours 46 min 1.34 sec) 

is there way speed selection? @ moment faster iterate on whole database in external tool , dumping out relevant rows.

edit

here explain of query:

+------+-------------+---------+-------+---------------+----------+---------+------+--------+-------------+ | id   | select_type | table   | type  | possible_keys | key      | key_len | ref  | rows   |       | +------+-------------+---------+-------+---------------+----------+---------+------+--------+-------------+ |    1 | simple      | sources | range | site_uri      | site_uri | 257     | null | 421418 | using | +------+-------------+---------+-------+---------------+----------+---------+------+--------+-------------+ 1 row in set (0.00 sec) 

do have index on uri column?

the index alone may help. if not, union make things faster (although quite ugly):

select * mytable uri = "uri1" union  select * mytable uri = "uri2" union select * mytable uri = "uri" 

Comments

Popular posts from this blog

routing - AngularJS State management ->load multiple states in one page -

python - GRASS parser() error -

Swift game error message -