pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Oleg Lebedev <olebedev@waterford.org>
Cc: Postgres SQL Mailing List <pgsql-sql@postgresql.org>
Subject: Re: won't drop the view
Date: Wed, 26 Dec 2001 17:25:50 -0500
Message-ID: <21237.1009405550@sss.pgh.pa.us> (raw)
In-Reply-To: <3C2A2791.830BE5F1@waterford.org>
References: <web-530735@davinci.ethosmedia.com>
	<8922.1008638480@sss.pgh.pa.us>
	<3C293ACB.4BEBA02F@waterford.org>
	<20130.1009385674@sss.pgh.pa.us>
	<3C2A2791.830BE5F1@waterford.org>

Oleg Lebedev <olebedev@waterford.org> 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



view thread (12+ messages)  latest in thread

Message-ID: <21237.1009405550@sss.pgh.pa.us>
Permalink:  ../21237.1009405550@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/21237.1009405550@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, olebedev@waterford.org
  Subject: Re: won't drop the view
  In-Reply-To: <21237.1009405550@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox