return 1st row;
}
-Original Message-
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Joshua Beall
Sent: Monday, December 06, 2004 12:40 PM
To: [EMAIL PROTECTED]
Subject: Selecting a random row
Hi All,
I understand that I can get a random row out of a table by doing
something like
SELEC
[snip]
> The way to
> enhance this is by selecting an indexed value, such as the following
> where `foo` is indexed
>
> SELECT `foo` FROM fortunes ORDER BY RAND() LIMIT 1
Why does this help? From the MySQL book I have, the reason ORDER BY
RAND() is slow is because "for each record in the table a
> How many rows do you anticipate that the table will have? Have you
> tested this on your server? I would have to bet that if you
> have only a few K rows that speed/performance will not be an issue.
I doubt I will have more than 100. Perhaps I shouldn't worry about it,
then.
> The way to
> en
[snip]
I understand that I can get a random row out of a table by doing
something
like
SELECT * FROM fortunes ORDER BY RAND() LIMIT 1
But I have also been told that this is a very slow operation.
I am building a script that will display a random saying, user
testimonial,
whatever, on a web pag
Hi All,
I understand that I can get a random row out of a table by doing something
like
SELECT * FROM fortunes ORDER BY RAND() LIMIT 1
But I have also been told that this is a very slow operation.
I am building a script that will display a random saying, user testimonial,
whatever, on a web p