From: | Herbert Liechti <herbie(at)thinx(dot)ch> |
---|---|
To: | "Tille, Andreas" <TilleA(at)rki(dot)de> |
Cc: | PostgreSQL General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Performance question |
Date: | 2001-09-10 12:41:54 |
Message-ID: | Pine.LNX.4.33.0109101437230.2932-100000@standbyme.thinx.ch |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Mon, 10 Sep 2001, Tille, Andreas wrote:
> On Mon, 10 Sep 2001 Herbert(dot)Liechti(at)thinx(dot)ch wrote:
>
> > Use explain. Explain tells you the query plan of the optimizer.
> >
> > explain SELECT .....;
> Thanks I just found the thread "Index usage question" and tried to make
> some profit from it:
>
> explain SELECT Hauptdaten_Fall.MeldeKategorie, Count(Hauptdaten_Fall.ID) AS Anz FROM Hauptdaten_Fall WHERE (((Hauptdaten_Fall.IstAktuell)=20)) GROUP BY Hauptdaten_Fall.MeldeKategorie ORDER BY Hauptdaten_Fall.MeldeKategorie;
>
> NOTICE: QUERY PLAN:
>
> Aggregate (cost=35267.33..36154.62 rows=17746 width=16)
> -> Group (cost=35267.33..35710.98 rows=177458 width=16)
> -> Sort (cost=35267.33..35267.33 rows=177458 width=16)
> -> Seq Scan on hauptdaten_fall (cost=0.00..15024.12 rows=177458 width=16)
I assume that an index on the field IstAktuell avoids the sequential scan.
If an index is there try the following statement before you submit the
query:
set enable_seqscan = off;
Regards Herbie
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Herbert Liechti http://www.thinx.ch
ThinX networked business services Adlergasse 5, CH-4500 Solothurn
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From | Date | Subject | |
---|---|---|---|
Next Message | Einar Karttunen | 2001-09-10 12:53:33 | Re: Performance question |
Previous Message | Tille, Andreas | 2001-09-10 12:34:25 | Re: Performance question |