mysql - Optimizing a long query (which uses order by rand() too) -


i have query looks like:

select picture_path, profile_picture, username users profile_picture not null , settings '1,%'  ,  last_visit between curdate() - interval 9 day , curdate()  , signup_date < curdate() - interval 10 day  order rand() limit 15"); 

this query can slow, , i'd optimize as possible.

should indexing fields used in query (a multi index of them together?)

is order rand() slowing query lot? alternative recommend?

there 700,000 records in db.

when explain query, http://screencast.com/t/opdx3fj80


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -