why does explain analyze differ so much from estimated explain?

From: Dirk Lutzebäck <lutzeb(at)aeccom(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: why does explain analyze differ so much from estimated explain?
Date: 2004-09-29 15:55:45
Message-ID: 415ADB01.9090001@aeccom.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hi,

I have a query where I do not understand that the rows number that
explain analyze finds differs so much from what explain estimates (3rd
nested loop estimates 1 row but in real it is 4222 rows). I did analyze
the tables (pgsql 7.4.1).

Here is the query:

explain analyze
SELECT fts.val_1, max(fts.val_2) AS val_2

FROM docobjflat AS fts,
boxinfo,
docobjflat AS ftw0,
docobjflat AS ftw, envspec_map

WHERE boxinfo.member=158096693
AND boxinfo.envelope=ftw.envelope
AND boxinfo.community=169964332
AND boxinfo.hide=FALSE
AND ftw0.flatid=ftw.flatid
AND fts.flatid=ftw.flatid
AND fts.docstart=1
AND envspec_map.spec=169964482
AND envspec_map.community=boxinfo.community
AND envspec_map.envelope=boxinfo.envelope

AND ftw0.val_14='IN-A01'

GROUP BY fts.val_1;

Query plan is attached.

Regards Dirk

Attachment Content-Type Size
qp text/plain 2.4 KB

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2004-09-29 16:18:13 Re: Poor Performance for large queries in functions
Previous Message John Meinel 2004-09-29 14:56:27 Re: [PERFORM] Poor Performance for large queries