Re: Select very slow...

From: David Olbersen <dave(at)slickness(dot)org>
To: "Fernando Eduardo B(dot) L(dot) e Carvalho" <feblec(at)ig(dot)com(dot)br>
Cc: Postgresql <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Select very slow...
Date: 2001-03-18 18:42:57
Message-ID: Pine.LNX.4.31.0103181038160.27741-100000@bubbles.electricutopia.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Sun, 18 Mar 2001, Fernando Eduardo B. L. e Carvalho wrote:

> select p.city,count(*) from sales s, person p where s.doc = p.doc
> group by p.city;
>
> Anyone help-me?

1: VACUUM ANALYZE sales
VACUUM ANALYZE person;

2: That 'count(*)' is going to be slow.
Try counting a column that's indexed (p.doc might work?)

3: EXPLAIN <your select from above>;
That should give you some hints on what to optimize.

-- Dave

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2001-03-18 20:37:41 Re: Trigger problem
Previous Message Fernando Eduardo B. L. e Carvalho 2001-03-18 09:15:42 Select very slow...