How to read a query plan? - Mailing list pgsql-general

From elwood@agouros.de (Konstantinos Agouros)
Subject How to read a query plan?
Date
Msg-id elwood.987583040@news.agouros.de
Whole thread Raw
Responses Re: How to read a query plan?
Re: How to read a query plan?
List pgsql-general
Hi,

since I am still working on my quite big database and the last time a simple
index saved my life I would like to understand query plans. Here are two
one without and one with index I see different numbers, but would like to know
what they mean:
logs=> explain select distinct on (url) url, category, action from websenseflat where webhost='dir.yahoo.com' and datum
>='1-26-2001'and datum < '1-27-2001'; 
NOTICE:  QUERY PLAN:

Unique  (cost=0.01..0.01 rows=1 width=36)
  ->  Sort  (cost=0.01..0.01 rows=1 width=36)
        ->  Seq Scan on websenseflat  (cost=0.00..0.00 rows=1 width=36)

EXPLAIN

after this I created an index on the field webhost, now the query plan says:

NOTICE:  QUERY PLAN:

Unique  (cost=19690.08..19690.22 rows=5 width=36)
  ->  Sort  (cost=19690.08..19690.08 rows=53 width=36)
        ->  Index Scan using wsflwebhost on websenseflat  (cost=0.00..19688.55 rows=53 width=36)

EXPLAIN

Could someone give me an interpretation (or a URL that explains this)?

Thanks,

Konstantin
--
Dipl-Inf. Konstantin Agouros aka Elwood Blues. Internet: elwood@agouros.de
Otkerstr. 28, 81547 Muenchen, Germany. Tel +49 89 69370185
----------------------------------------------------------------------------
"Captain, this ship will not sustain the forming of the cosmos." B'Elana Torres

pgsql-general by date:

Previous
From: DaVinci
Date:
Subject: Passing a row (NEW) as function argument
Next
From: newsreader@mediaone.net
Date:
Subject: watch your DBI scripts if you are upgrading to 7.1