Re: The Last Optimization

From: Bill Gribble <grib(at)linuxdevel(dot)com>
To: Areski Belaid <areski5(at)hotmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: The Last Optimization
Date: 2002-09-06 18:06:47
Message-ID: 1031335607.13961.290.camel@firetrap
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, 2002-09-06 at 12:09, Areski Belaid wrote:
> The "select count" have to check all of them and it's not the case with
> "LIMIT"! Right ?

count() is slow for large tables, period.

If you know that you have some very large tables that need to be counted
frequently, you can make a small table called
"my_counts(tablename TEXT, rows INTEGER)" and update it with INSERT and
DELETE triggers on the tables. Then, you can define a function which
will read that table rather than executing a query on a large table.

b.g.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2002-09-06 18:11:36 Re: Surprise :-(
Previous Message Mihai Gheorghiu 2002-09-06 17:59:10 Re: Surprise :-(