Received: from sss.pgh.pa.us ([192.204.191.242]) by postgresql.org (8.11.3/8.11.4) with ESMTP id fBQMPom31926 for ; Wed, 26 Dec 2001 17:25:50 -0500 (EST) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id fBQMPoj21240; Wed, 26 Dec 2001 17:25:50 -0500 (EST) To: Oleg Lebedev cc: Postgres SQL Mailing List Subject: Re: won't drop the view In-reply-to: <3C2A2791.830BE5F1@waterford.org> References: <8922.1008638480@sss.pgh.pa.us> <3C293ACB.4BEBA02F@waterford.org> <20130.1009385674@sss.pgh.pa.us> <3C2A2791.830BE5F1@waterford.org> Comments: In-reply-to Oleg Lebedev message dated "Wed, 26 Dec 2001 12:40:01 -0700" Date: Wed, 26 Dec 2001 17:25:50 -0500 Message-ID: <21237.1009405550@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200112/249 X-Sequence-Number: 6071 Oleg Lebedev writes: > yeilds 235 rows, with a total of 240 rows in activity table. I wonder > why EXPLAIN estimates only 1 row? Ugh, that's a pretty horrible misestimation. What do you get from select attname,attdispersion,s.* from pg_statistic s, pg_attribute a, pg_class c where starelid = c.oid and attrelid = c.oid and staattnum = attnum and relname = 'activity'; (you'll need to do "VACUUM ANALYZE activity" first). > Are there any online docs on how the planner works? The first two sections of http://developer.postgresql.org/docs/postgres/performance-tips.html are a starting point --- but keep in mind that section 11.2 describes PG 7.2's stats. The pg_statistic scheme in 7.1 is much simpler. I am hoping that 7.2 will get a better result for this query, but can't tell without more info. regards, tom lane