Re: Question on COUNT performance

From: Reinoud van Leeuwen <reinoud(dot)v(at)n(dot)leeuwen(dot)net>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Question on COUNT performance
Date: 2010-07-14 12:30:29
Message-ID: 20100714123029.GH62243@spoetnik.xs4all.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Wed, Jul 14, 2010 at 09:58:10PM +1000, Anders ??stergaard Jensen wrote:
> Hello mailing list,
>
> I have a performance problem with my postgres 8.4.4 database. The query is
> the following:
>
> SELECT count(*) AS count_all FROM "plan_events" WHERE (f_plan_event_acl(17,
> plan_events.id))
>
> QUERY PLAN
>
> ------------------------------------------------------------------------------------------------------------------------
> Aggregate (cost=2859.77..2859.78 rows=1 width=0) (actual
> time=4641.720..4641.720 rows=1 loops=1)
> -> Seq Scan on plan_events (cost=0.00..2851.44 rows=3331 width=0)
> (actual time=32.821..4640.116 rows=2669 loops=1)
> Filter: f_plan_event_acl(17, id)
> Total runtime: 4641.753 ms
> (4 rows)
>
>
>
> What can I do to improve the performance?

Have you tried 'select count (1)..."?

Reinoud

--
__________________________________________________
"Nothing is as subjective as reality"
Reinoud van Leeuwen reinoud(dot)v(at)n(dot)leeuwen(dot)net
http://reinoud.van.leeuwen.net kvk 27320762
__________________________________________________

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Jean-David Beyer 2010-07-14 12:37:06 Re: subtract two dates to get the number of days
Previous Message Anders Østergaard Jensen 2010-07-14 11:58:10 Question on COUNT performance