On Fri, Jan 26, 2007 at 09:16:41AM -0700, Dennis Cote wrote:
> The offset mechanism proposed by Igor earlier is far more efficient as
> long as you know the size of the table. You can always get the size from
> a count query, which also requires a table scan, but even that is less
> expensive
Igor Tandetnik wrote:
P Kishor <[EMAIL PROTECTED]> wrote:
On 1/25/07, Artem Yankovskiy
select * from table1 order by random(id) limit 1
Yes, very nice, thank you. I am not familiar with the "ORDER BY
random(col)" idiom. How does this work? (It does work alright).
random(anything) produces
P Kishor <[EMAIL PROTECTED]> wrote:
On 1/25/07, Artem Yankovskiy
wrote:
select * from table1 order by random(id) limit 1
Yes, very nice, thank you. I am not familiar with the "ORDER BY
random(col)" idiom. How does this work? (It does work alright).
random(anything) produces a random
P Kishor <[EMAIL PROTECTED]> wrote:
1. given a non-sequential id, select all the ids
2. grab a random id
3. select the row with that id.
is there a better way of accomplishing this, one that requires a
single round-trip to the db?
If you can somehow keep track of the number of rows (N) in the
4 matches
Mail list logo