http://www.depesz.com/index.php/2007/09/16/my-thoughts-on-getting-random-row/
explains alternate approaches than using order by random().
"this is very good way to get truly random records. there is no “preference”
for specific rows. the major drawback is speed. or lack of it actually."
any orderby is over-head (small or big). Also limit with order by is not
cost-efficient since limiting is done after ordering rows, resulting in
fetching of all rows.
For time being, I am using executesql to execute my query.
*use this:*
*
*
*db().select(db.person.name, orderby="", limitby=(0,50))*
On Thu, Sep 22, 2011 at 4:43 AM, Tarun Arora wrote:
> *db().select(db.person.name, orderby=db.person.id, limitby(0,50))*
--
--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]
[ Aprenda a programar: http://Curs
I have a requirement, just to have 50 random records from table without any
order. I don't want to use any orderby condition as number of records in
tables is very large and any ordering is over-head cost when I need random
records. A query like *db().select(db.person.name, limitby=(0,50))
*aut
4 matches
Mail list logo