Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id A7BBF9FB251 for ; Wed, 11 Oct 2006 11:51:11 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 34190-10 for ; Wed, 11 Oct 2006 14:51:03 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey- Received: from webmail.enterprisedb.com (edb04.managed.contegix.com [63.246.7.176]) by postgresql.org (Postfix) with ESMTP id 9152C9FA5DC for ; Wed, 11 Oct 2006 11:51:03 -0300 (ADT) Received: from [192.168.1.34] (client-82-14-78-41.glfd.adsl.virgin.net [82.14.78.41]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by webmail.enterprisedb.com (Postfix) with ESMTP id D21BDA24DEE; Wed, 11 Oct 2006 09:51:00 -0500 (CDT) Message-ID: <452D04DF.4040904@enterprisedb.com> Date: Wed, 11 Oct 2006 15:51:11 +0100 From: Heikki Linnakangas User-Agent: Thunderbird 1.5.0.7 (X11/20060915) MIME-Version: 1.0 To: Bucky Jordan CC: Tom Lane , Brian Herlihy , Postgresql Performance Subject: Re: Simple join optimized badly? References: <78ED28FACE63744386D68D8A9D1CF5D4209C7A@MAIL.corp.lumeta.com> In-Reply-To: <78ED28FACE63744386D68D8A9D1CF5D4209C7A@MAIL.corp.lumeta.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.135 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200610/221 X-Sequence-Number: 21350 Bucky Jordan wrote: > > Is this along the lines of "I'm loading a big table and touching every > row of data, so I may as well collect some stats along the way" and "I > know my data contains these statistical properties, but the analyzer > wasn't able to figure that out (or maybe can't figure it out efficiently > enough)"? > > While it seems like this would require more knowledge from the user > (e.g. more about their data, how the planner works, and how it uses > statistics) this would actually be helpful/required for those who really > care about performance. ... The user would have to know his data, but he wouldn't need to know how the planner works. While with hints like "use index X", he *does* need to know how the planner works. Being able to give hints about statistical properties of relations and their relationships seems like a good idea to me. And we can later figure out ways to calculate them automatically. BTW, in DB2 you can declare a table as volatile, which means that the cardinality of the table varies greatly. The planner favors index scans on volatile tables. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com