Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 9A12C9FB427 for ; Sun, 8 Oct 2006 23:12:17 -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 20002-06 for ; Sun, 8 Oct 2006 23:12:15 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from momjian.us (momjian.us [70.90.9.53]) by postgresql.org (Postfix) with ESMTP id 82B7C9FB360 for ; Sun, 8 Oct 2006 23:12:13 -0300 (ADT) Received: (from bruce@localhost) by momjian.us (8.11.6/8.11.6) id k992CCP10515; Sun, 8 Oct 2006 22:12:12 -0400 (EDT) From: Bruce Momjian Message-Id: <200610090212.k992CCP10515@momjian.us> Subject: Re: Simple join optimized badly? In-Reply-To: <267982364.11091160349938551.OPEN-XCHANGE.WebMail.tomcat@edb04.managed.contegix.com> To: "Jonah H. Harris" Date: Sun, 8 Oct 2006 22:12:12 -0400 (EDT) CC: josh@agliodbs.com, pgsql-performance@postgresql.org, Denis Lussier , Tom Lane , "korryd@enterprisedb.com" , "Craig A. James" X-Mailer: ELM [version 2.4ME+ PL123] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="US-ASCII" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.082 tagged_above=0 required=5 tests=AWL, SPF_HELO_PASS, SPF_PASS X-Spam-Level: X-Archive-Number: 200610/146 X-Sequence-Number: 21275 Jonah H. Harris wrote: > On Oct 08, 2006 07:05 PM, Josh Berkus wrote: > > Hints are used because the DBA thinks that they are smarter than > > the optimizer; 99% of the time, they are wrong. > > That's a figure which I'm 100% sure cannot be backed up by fact. > > > Just try manually optimizing a complex query, you'll see -- with three > > join types, several scan types, aggregates, bitmaps, [blah blah blah] > > it's significantly more than a human can figure out accurately. > > Let me get this right... the optimizer is written by humans who know and > can calculate the proper query plan and generate code to do the same; > yet humans aren't smart enough to optimize the queries themselves? A bit > of circular reasoning here? I can do 100! on my computer, but can't do it in my head. -- Bruce Momjian bruce@momjian.us EnterpriseDB http://www.enterprisedb.com + If your life is a hard drive, Christ can be your backup. +