Received: from sss.pgh.pa.us ([192.204.191.242]) by postgresql.org (8.11.3/8.11.4) with ESMTP id fBR4rum47844 for ; Wed, 26 Dec 2001 23:53:56 -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 fBR4s0j22876; Wed, 26 Dec 2001 23:54:00 -0500 (EST) To: Oleg Lebedev cc: Postgres SQL Mailing List Subject: Re: won't drop the view In-reply-to: <3C2A7DF0.C4382382@waterford.org> References: <8922.1008638480@sss.pgh.pa.us> <3C293ACB.4BEBA02F@waterford.org> <20130.1009385674@sss.pgh.pa.us> <3C2A7DF0.C4382382@waterford.org> Comments: In-reply-to Oleg Lebedev message dated "Wed, 26 Dec 2001 18:48:32 -0700" Date: Wed, 26 Dec 2001 23:54:00 -0500 Message-ID: <22873.1009428840@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200112/251 X-Sequence-Number: 6073 Oleg Lebedev writes: > 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'; > attname | attdispersion | starelid | staattnum | staop | stanullfrac | stacommonfrac | stacommonval | staloval | stahival > -------------------------+---------------+----------+-----------+-------+-------------+---------------+--------------------------------------+-------------+------------------------------ > productcode | 0.002625 | 14559105 | 17 | 1066 | 0 | 0.0125 | m3nt22 | 0000 | t3nt15 Well, I can see that 7.1 wouldn't be likely to make a good estimate about the selectivity of productcode ~ '^m3' on this table; it doesn't take stacommonval into account (and that's only 1% of the table anyway), and the range '0000' .. 't3nt15' is too wide to make it plausible that m3's take up 98% of the table. I believe 7.2 will do better though. Care to try out your database with a beta version? regards, tom lane