Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 98566475AF0 for ; Mon, 22 Apr 2002 13:40:23 -0400 (EDT) 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 g3MHeLF17410; Mon, 22 Apr 2002 13:40:21 -0400 (EDT) To: nickf@ontko.com Cc: "pgsql-admin" Subject: Re: An Analyze question In-reply-to: References: Comments: In-reply-to "Nick Fankhauser" message dated "Mon, 22 Apr 2002 12:24:27 -0500" Date: Mon, 22 Apr 2002 13:40:21 -0400 Message-ID: <17407.1019497221@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200204/203 X-Sequence-Number: 4091 "Nick Fankhauser" writes: > The "Before" database: > attname | attdispersion | starelid | staattnum | staop | > stanullfrac | stacommonfrac | stacommonval | staloval | > stahival > --------------------------+---------------+----------+-----------+-------+-- > -----------+---------------+---------------+-----------------------------+-- > --------------------- > actor_id | 0.00761992 | 2591915 | 1 | 1066 | > 0 | 0.0335872 | JTW | 18105A08315 49 | XS > The "After" database: > attname | attdispersion | starelid | staattnum | staop | > stanullfrac | stacommonfrac | stacommonval | staloval > | stahival > --------------------------+---------------+----------+-----------+-------+-- > -----------+---------------+--------------------+--------------------------- > -+----------------------- > actor_id | 0.03247 | 33979335 | 1 | 1066 | > 0 | 0.112092 | 18105XS | 18105A | > 18105XS Hm. In the "before" case you are showing JTW as the most common actor_id, with a frequency of 3.36% of the entries (busy judge, I suppose). In the "after" case you are showing "18105XS" as the most common actor_id, with a frequency of 11.2% of the entries. Where'd that come from? Is it correct? The change in plans occurs because of the increase in stacommonfrac. 7.1 basically uses stacommonfrac as the selectivity estimate if the constant is the stacommonval, otherwise stacommonfrac/10. So if stacommonfrac goes up, so does the estimated number of rows retrieved, and that's what's changing your plan. regards, tom lane