MySQL Forums
Forum List  »  Performance

Select random rows when using UUID
Posted by: Jonathan Keen
Date: June 09, 2016 11:43AM

I'm finding it necessary to return multiple random rows while using UUID - specifically https://github.com/ramsey/uuid. The UUID's are similar to: 25769c6c-d34d-4bfe-ba98-e0ee856f3e7a

Most of the efficient means of finding random records require using an auto incrementing primary key. While I can select one record randomly by using an offset clause, I feel like there has to be a better way of selecting a random UUID and then getting multiple random rows at the same time. This will stop the issue of having to COUNT the rows for an offset as well as only having to hit the database once.

Any ideas?

Rick James, if you're reading this, kinda stumbled on your blog post "Fetching Random Rows from a Table". Was wondering if you developed a good method for returning random UUID's, you seemed to hint at it...

Thanks in advance!

Options: ReplyQuote


Subject
Views
Written By
Posted
Select random rows when using UUID
724
June 09, 2016 11:43AM


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.