X-Original-To: pgsql-performance-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id D82629FA5D2 for ; Thu, 15 Jun 2006 21:28:37 -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 67495-08 for ; Thu, 15 Jun 2006 21:28:30 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp1.ActiveState.com (gw.activestate.com [209.17.183.249]) by postgresql.org (Postfix) with ESMTP id CB1289FA160 for ; Thu, 15 Jun 2006 21:28:30 -0300 (ADT) Received: from smtp3.activestate.com (smtp3.activestate.com [192.168.3.19]) by smtp1.ActiveState.com (8.12.10/8.12.10) with ESMTP id k5G0SAZt005053 for ; Thu, 15 Jun 2006 17:28:11 -0700 (envelope-from mischa@ca.sophos.com) Received: from [192.168.99.210] (mallet.activestate.com [192.168.99.210]) by smtp3.ActiveState.com (8.13.4/8.13.4) with ESMTP id k5G0S8PD000966 for ; Thu, 15 Jun 2006 17:28:09 -0700 (envelope-from mischa@ca.sophos.com) Message-ID: <4491FD06.50901@ca.sophos.com> Date: Thu, 15 Jun 2006 17:36:22 -0700 From: Mischa Sandberg Reply-To: mischa@ca.sophos.com User-Agent: Thunderbird 1.5.0.4 (X11/20060516) MIME-Version: 1.0 To: PGSQL Performance Subject: Re: Optimizer internals References: <1150396425.31200.66.camel@archimedes> In-Reply-To: <1150396425.31200.66.camel@archimedes> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/336 X-Sequence-Number: 19693 Mark Lewis wrote: > On Thu, 2006-06-15 at 14:05 -0400, John Vincent wrote: >> Now I've been told by our DBA that we should have been able to wholy >> satisfy that query via the indexes. > DB2 can satisfy the query using only indexes because DB2 doesn't do > MVCC. You can get pretty much the same effect with materialized views. Create a table that LOOKS like the index (just those columns), with a foreign key relationship to the original table (cascade delete), and have the after-insert trigger on the main table write a row to the derived table. Now (index and) query the skinny table. Advantage of these tables: you can cluster them regularily, because it doesn't hard-lock the main table. -- Engineers think that equations approximate reality. Physicists think that reality approximates the equations. Mathematicians never make the connection.