Re: [HACKERS] Slow count(*) again...

From: Samuel Gendler <sgendler(at)ideasculptor(dot)com>
To: David Wilson <david(dot)t(dot)wilson(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, david(at)lang(dot)hm, Vitalii Tymchyshyn <tivv00(at)gmail(dot)com>, Jon Nelson <jnelson+pgsql(at)jamponi(dot)net>, Mladen Gogala <mladen(dot)gogala(at)vmsinfo(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Bruce Momjian <bruce(at)momjian(dot)us>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>, "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: [HACKERS] Slow count(*) again...
Date: 2011-02-04 06:36:20
Message-ID: AANLkTi=AqJ_GohhV1usnr7tKxDuoPy5pte7Hz_xtxUjZ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers 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(dot)t(dot)wilson(at)gmail(dot)com>wrote:

>
>
> On Thu, Feb 3, 2011 at 6:05 PM, Robert Haas <robertmhaas(at)gmail(dot)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(dot)t(dot)wilson(at)gmail(dot)com
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Віталій Тимчишин 2011-02-04 07:08:59 Re: [HACKERS] Slow count(*) again...
Previous Message Itagaki Takahiro 2011-02-04 05:39:59 Re: Add ENCODING option to COPY

Browse pgsql-performance by date

  From Date Subject
Next Message Віталій Тимчишин 2011-02-04 07:08:59 Re: [HACKERS] Slow count(*) again...
Previous Message David Wilson 2011-02-04 05:06:18 Re: [HACKERS] Slow count(*) again...