List:General Discussion« Previous MessageNext Message »
From:Rob Wultsch Date:May 19 2008 3:19pm
Subject:Re: improving random record selection
View as plain text  
On Mon, May 19, 2008 at 7:24 AM, Jerry Schwartz
<jschwartz@stripped> 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" distribution; by that I think you mean that the probability
> of selecting any given record is the same. If you have gaps in your data, I can't think of
> any way to do that other than be assigning a unique and sequential ID to each record. If
> you ever delete a record, you'd have to renumber the remaining ones. Then you'd pick off a
> random value for this unique ID.

There are alternatives. (generating a random number for each row for
example, take a look at the original conversation). Having to keep the
sequence holeless would be a pain in the back side, but could be done
with a trigger running something like I describe in the thread -> .

Rob Wultsch
wultsch (aim)
improving random record selectionScott Haneda17 May
  • Re: improving random record selectionRob Wultsch18 May
    • RE: improving random record selectionJerry Schwartz19 May
      • Re: improving random record selectionRob Wultsch19 May
        • RE: improving random record selectionJerry Schwartz19 May
  • RE: improving random record selectionJerry Schwartz19 May