RE: improving random record selection

2008-05-19 Thread Jerry Schwartz
From: Scott Haneda [mailto:[EMAIL PROTECTED] Sent: Saturday, May 17, 2008 5:32 PM To: mysql@lists.mysql.com Subject: improving random record selection I posted this a month or so ago, and was helped a little, but I am now back. Currently I use select x, y, z from images where (condition) order

RE: improving random record selection

2008-05-19 Thread Jerry Schwartz
-Original Message- From: Rob Wultsch [mailto:[EMAIL PROTECTED] Sent: Saturday, May 17, 2008 6:47 PM To: Scott Haneda Cc: mysql@lists.mysql.com Subject: Re: improving random record selection On Sat, May 17, 2008 at 2:32 PM, Scott Haneda [EMAIL PROTECTED] wrote: $sql

Re: improving random record selection

2008-05-19 Thread Rob Wultsch
On Mon, May 19, 2008 at 7:24 AM, Jerry Schwartz [EMAIL PROTECTED] wrote: I might not understand what this is doing, but I think it will preferentially sample the ids that are at the end of a gap. What don't you understand about the query or the way I described it? You say you want a flat

RE: improving random record selection

2008-05-19 Thread Jerry Schwartz
-Original Message- From: Rob Wultsch [mailto:[EMAIL PROTECTED] Sent: Monday, May 19, 2008 11:20 AM To: Jerry Schwartz Cc: Scott Haneda; mysql@lists.mysql.com Subject: Re: improving random record selection On Mon, May 19, 2008 at 7:24 AM, Jerry Schwartz [EMAIL PROTECTED] wrote: I might

Re: improving random record selection

2008-05-17 Thread Rob Wultsch
On Sat, May 17, 2008 at 2:32 PM, Scott Haneda [EMAIL PROTECTED] wrote: $sql = SELECT storage_path, image_md5, t.id FROM images AS t JOIN (SELECT CEIL(MAX(id)*RAND()) AS id FROM images) AS x ON (t.id = x.id)