Re: [SQLObject] Select Single Random Record
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
|
From: Petr J. <pet...@tp...> - 2012-04-18 19:43:34
|
> Although this might work in the particular application, but > it is hardly ideal to make two queries, nor to load a long list > of IDs. Is there a way to do it with a single query? > > 1) Is your task really "time critical"? How many records (IDs) do you expect to be returned using the first select? How many kb will it take? Is the list size a real problem for your Internet connection? How often do you expect to release the select querry? 2) what is your target database engine? some databases allow "rand" in the select query. see: http://stackoverflow.com/questions/19412/how-to-request-a-random-row-in-sql Petr |