Re: The Last Optimization - Mailing list pgsql-general

From Bill Gribble
Subject Re: The Last Optimization
Date
Msg-id 1031335607.13961.290.camel@firetrap
Whole thread Raw
In response to The Last Optimization  ("Areski Belaid" <areski5@hotmail.com>)
List 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.


pgsql-general by date:

Previous
From: "Mihai Gheorghiu"
Date:
Subject: Re: Surprise :-(
Next
From: Stephan Szabo
Date:
Subject: Re: Surprise :-(