MySQL Forums
Forum List  »  Optimizer & Parser

Re: Strategy needed for picking random rows
Posted by: Joachim Berger
Date: September 08, 2011 08:05AM

Thank you Rick,

I have a few questions on your comments:

You said that the LIMIT needs to be in the subselect. However, that is not possible, because almost always I have to add one or two more (unindexed) criteria like haircolor etc. to the outer select. Is there any way around this problem, or is it okay then to leave the LIMIT in the outer query?

You said that Id needs to be part of the index, excpet it is an innodb primary key. The table is innodb, but it's not the primary key. Howver, the explain seems not to be missing anything. Why (and where) do I need the Id in the index?

I will eventually try your second rnd suggestion and get back to you, if that's okay.

Options: ReplyQuote

Written By
Re: Strategy needed for picking random rows
September 08, 2011 08:05AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.