Re: won't drop the view

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Oleg Lebedev <olebedev(at)waterford(dot)org>
Cc: Postgres SQL Mailing List <pgsql-sql(at)postgresql(dot)org>
Subject: Re: won't drop the view
Date: 2001-12-26 22:25:50
Message-ID: 21237.1009405550@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Oleg Lebedev <olebedev(at)waterford(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Oleg Lebedev 2001-12-27 01:48:32 Re: won't drop the view
Previous Message Oleg Lebedev 2001-12-26 19:40:01 Re: won't drop the view