Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 4163D9FB3B5 for ; Sun, 8 Oct 2006 23:45:03 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 26323-03 for ; Sun, 8 Oct 2006 23:44:59 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from pro25.abac.com (pro25.abac.com [66.226.64.26]) by postgresql.org (Postfix) with ESMTP id AD67B9FB360 for ; Sun, 8 Oct 2006 23:44:57 -0300 (ADT) Received: from [192.168.0.3] (wsip-70-167-125-69.sd.sd.cox.net [70.167.125.69]) (authenticated bits=0) by pro25.abac.com (8.13.8/8.13.8) with ESMTP id k992im18097104 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 8 Oct 2006 19:44:49 -0700 (PDT) (envelope-from cjames@modgraph-usa.com) Message-ID: <4529B724.9070904@modgraph-usa.com> Date: Sun, 08 Oct 2006 19:42:44 -0700 From: "Craig A. James" User-Agent: Thunderbird 1.5.0.7 (X11/20060909) MIME-Version: 1.0 To: Bruce Momjian CC: pgsql-performance@postgresql.org Subject: Re: Simple join optimized badly? References: <200610090212.k992CCP10515@momjian.us> In-Reply-To: <200610090212.k992CCP10515@momjian.us> 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.094 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200610/148 X-Sequence-Number: 21277 Bruce Momjian wrote: > I can do 100! on my computer, but can't do it in my head. A poor example. 100! is a simple repetative calculation, something computers are very good at. Optimizing an SQL query is very difficult, and a completely different class of problem. The fact is the PG team has done a remarkable job with the optimizer so far. I'm usually very happy with its plans. But humans still beat computers at many tasks, and there are unquestionably areas where the PG optimizer is not yet fully developed. When the optimizer reaches its limits, and you have to get your web site running, a HINT can be invaluable. I said something in a previous version of this topic, which I'll repeat here. The PG documentation for HINTs should be FILLED with STRONG ADMONITIONS to post the problematic queries here before resorting to hints. There will always be fools who abuse hints. Too bad for them, but don't make the rest of us suffer for their folly. Craig