Re: [PHP] How to find random records in a subset?

2005-06-05 Thread Jochem Maas
Brian Dunning wrote: I am using a routine to find 50 random records in a large MySQL how random does it need to be? if *psuedo* (nobody start on the computer random is not really random argument - go watch What the bleep do we know? instead) random is okay maybe you could define a list of

Re: [PHP] How to find random records in a subset?

2005-06-03 Thread Kristen G. Thorson
Try using a temporary table. It should be pretty fast. You'd do something like 1. Select from table1 according to search criteria 2. Insert data from #1 into temp_table1 3. Random selection from temp_table1 kgt Brian Dunning wrote: I am using a routine to find 50 random records in a

Re: [PHP] How to find random records in a subset?

2005-06-03 Thread Marek Kilimajer
Brian Dunning wrote: I am using a routine to find 50 random records in a large MySQL database (about a million records) where I generate a list of 50 random unique ID's, why can't you use the where condition in the above query? and then use MySQL's in command to find them. I can't use

Re: [PHP] How to find random records in a subset?

2005-06-03 Thread Brian Dunning
On Jun 3, 2005, at 6:48 AM, Marek Kilimajer wrote: Brian Dunning wrote: I am using a routine to find 50 random records in a large MySQL database (about a million records) where I generate a list of 50 random unique ID's, why can't you use the where condition in the above query?

Re: [PHP] How to find random records in a subset?

2005-06-03 Thread Marek Kilimajer
Brian Dunning wrote: On Jun 3, 2005, at 6:48 AM, Marek Kilimajer wrote: Brian Dunning wrote: I am using a routine to find 50 random records in a large MySQL database (about a million records) where I generate a list of 50 random unique ID's, why can't you use the where condition in

Re: [PHP] How to find random records in a subset?

2005-06-03 Thread Richard Lynch
On Thu, June 2, 2005 4:31 pm, Brian Dunning said: I am using a routine to find 50 random records in a large MySQL database (about a million records) where I generate a list of 50 random unique ID's, and then use MySQL's in command to find them. I can't use order by rand() due to its

Re: [PHP] How to find random records in a subset?

2005-06-03 Thread Satyam
Richard Lynch [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] How do you generate a list of 50 random unique IDs in the first place? By using the SQL function to create those randoms How to you guarantee that all those IDs are in the database? No need for that. When you do

[PHP] How to find random records in a subset?

2005-06-02 Thread Brian Dunning
I am using a routine to find 50 random records in a large MySQL database (about a million records) where I generate a list of 50 random unique ID's, and then use MySQL's in command to find them. I can't use order by rand() due to its performance hit. But I have to take it one more step: I