Re: [HACKERS] Slow count(*) again... - Mailing list pgsql-performance

From Samuel Gendler
Subject Re: [HACKERS] Slow count(*) again...
Date
Msg-id AANLkTi=AqJ_GohhV1usnr7tKxDuoPy5pte7Hz_xtxUjZ@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] Slow count(*) again...  (David Wilson <david.t.wilson@gmail.com>)
List pgsql-performance
Neat.  That was my 'you learn something every day' moment.  Thanks.

On Thu, Feb 3, 2011 at 9:06 PM, David Wilson <david.t.wilson@gmail.com> wrote:


On Thu, Feb 3, 2011 at 6:05 PM, Robert Haas <robertmhaas@gmail.com> wrote:

If you want to randomly pick 10,000 rows out of all the rows that are
going to be inserted in the table without knowing in advance how many
there will be, how do you do that?

Reservoir sampling, as the most well-known option: http://en.wikipedia.org/wiki/Reservoir_sampling

--
- David T. Wilson
david.t.wilson@gmail.com

pgsql-performance by date:

Previous
From: David Wilson
Date:
Subject: Re: [HACKERS] Slow count(*) again...
Next
From: Віталій Тимчишин
Date:
Subject: Re: [HACKERS] Slow count(*) again...