On Friday, 28 February 2014 23:57:06 UTC+1, martijn korse wrote: > > Btw: before i get into a discussion about the usage of ORDER BY RAND() : > ultimately the query will be much more complex with lots of filters (where > clauses) that should be taken into account while selecting a random row. > This makes it impossible to use a trick like selecting a random primary key > first to speed up performance. Also, i will be selecting much more data > then the few columns i have now. >
I would retrieve the words you need, using your filters (where clauses). That gives a collection of which you know how many members it has. Add a field to that result-collection to incremenally give them a number. Then generate a random integer between 1 and the number of result-items and select that Word. I would make an entity for that holding a Word entity plus the incremental number to identify the n-th record. No need to use native queries etc. then. Using an ORM is to simplify things, not to make it more complicated. -- You received this message because you are subscribed to the Google Groups "doctrine-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/doctrine-user. For more options, visit https://groups.google.com/groups/opt_out.
