Re: select count(*) and limit

From: Sean Davis <sdavis2(at)mail(dot)nih(dot)gov>
To: Verena Ruff <lists(at)triosolutions(dot)at>, <pgsql-novice(at)postgresql(dot)org>
Subject: Re: select count(*) and limit
Date: 2006-05-18 19:10:36
Message-ID: C0923EEC.BB62%sdavis2@mail.nih.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On 5/18/06 12:28 PM, "Verena Ruff" <lists(at)triosolutions(dot)at> wrote:

> Hi,
>
> Sean Davis schrieb:
>> It should still work just fine, again with the caveat that it is an
>> approximation and depends on the statistics available. Try comparing the
>> output a few times for your count(*) and using EXPLAIN.
>>
> sometimes the difference is to much to go this way. EXPLAIN extimates
> 71000 rows but there are 95000. 10% would have been accaptle. I did
> these tests on a freshly vacuumed database.

You can change the statistics that are collected, if you like. Again, there
is stuff in the docs about doing that.

Sean

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Verena Ruff 2006-05-19 06:52:02 Re: select count(*) and limit
Previous Message Verena Ruff 2006-05-18 16:28:31 Re: select count(*) and limit