Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 76ABC133798E for ; Thu, 11 Nov 2010 13:13:17 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 22528-05 for ; Thu, 11 Nov 2010 17:13:10 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from lpo-relay-05.vmsinfo.com (lpo-relay-05.vmsinfo.com [216.169.137.116]) by mail.postgresql.org (Postfix) with ESMTP id 0CB6C1337B4A for ; Thu, 11 Nov 2010 13:13:09 -0400 (AST) X-IronPort-AV: E=Sophos;i="4.59,184,1288584000"; d="scan'208";a="30080082" Received: from unknown (HELO lpo-mailbox-02.vmsinfo.com) ([216.169.137.252]) by lpo-relay-05.vmsinfo.com with ESMTP; 11 Nov 2010 12:13:09 -0500 Received: from [10.101.43.35] (lpo-autonomy-p03.vmsinfo.com [216.169.135.234]) by lpo-mailbox-02.vmsinfo.com (Postfix) with ESMTP id 458FE562A1; Thu, 11 Nov 2010 12:13:09 -0500 (EST) Message-ID: <4CDC2424.9010102@vmsinfo.com> Date: Thu, 11 Nov 2010 12:13:08 -0500 From: Mladen Gogala Organization: VMS User-Agent: Thunderbird 2.0.0.24 (X11/20101027) MIME-Version: 1.0 To: Kevin Grittner CC: Robert Haas , "pgsql-performance@postgresql.org" , Tom Lane Subject: Re: anti-join chosen even when slower than old plan References: <4CD9663502000025000374B1@gw.wicourts.gov> <20961.1289347680@sss.pgh.pa.us> <4CDA62C60200002500037512@gw.wicourts.gov> <4CDACBBF020000250003755B@gw.wicourts.gov> <4CDB7BAA.7020506@vmsinfo.com> <4CDBB0A40200002500037571@gw.wicourts.gov> In-Reply-To: <4CDBB0A40200002500037571@gw.wicourts.gov> 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=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201011/152 X-Sequence-Number: 41176 Kevin Grittner wrote: > Mladen Gogala wrote: > > >> create a definitive bias toward one type of the execution plan. >> > > We're talking about trying to support the exact opposite. I understand this, that is precisely the reason for my intervention into the discussion of experts, which I am not. > This all > started because a database which was tuned for good response time > for relatively small queries against a "hot" portion of some tables > chose a bad plan for a weekend maintenance run against the full > tables. We're talking about the possibility of adapting the cost > factors based on table sizes as compared to available cache, to more > accurately model the impact of needing to do actual disk I/O for > such queries. > Kevin, in my experience, the hardest thing to do is to tune so called mixed type databases. In practice, databases are usually separated: OLTP database on one group of servers, reporting database and the data warehouse on another group of servers. Postgres 9.0 has made a great stride toward such possibility with the new replication facilities. Again, having an optimizer which will choose the plan completely accurately is, at least in my opinion, less important than having a possibility of manual control, the aforementioned "knobs and buttons" and produce the same plan for the same statement. Trying to make the optimizer smart enough for all types of loads is akin to looking for the Holy Grail. Inevitably, you will face some hard questions, like the one about the airspeed velocity of an unladen swallow, and the whole search is likely to end in pretty funny way, not producing the desired "optimizing genie in the CPU". > > This also is very different from trying to adapt queries to what > happens to be currently in cache. As already discussed on a recent > thread, the instability in plans and the failure to get to an > effective cache set make that a bad idea. The idea discussed here > would maintain a stable plan for a given query, it would just help > choose a good plan based on the likely level of caching. > Kevin, I am talking from the perspective of a DBA who is involved with a production databases on day-to-day basis. I am no expert but I do believe to speak from a perspective of users that Postgres has to win in order to make further inroads into the corporate server rooms. Without the possibility of such control and the plan stability, it is hard for me to recommend more extensive use of PostgreSQL to my boss. Whatever solution is chosen, it needs to have "knobs and buttons" and produce the plans that will not change when the CPU usage goes up. -- Mladen Gogala Sr. Oracle DBA 1500 Broadway New York, NY 10036 (212) 329-5251 http://www.vmsinfo.com The Leader in Integrated Media Intelligence Solutions