X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id EBFCB9DC9A1; Tue, 28 Feb 2006 12:45:20 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 60557-09; Tue, 28 Feb 2006 12:45:19 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id E68399DCA1B; Tue, 28 Feb 2006 12:45:16 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 38AAF56462; Tue, 28 Feb 2006 10:45:16 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 28 Feb 2006 10:45:15 -0600 Date: Tue, 28 Feb 2006 10:45:15 -0600 From: "Jim C. Nasby" To: Kevin Grittner Cc: pgsql-hackers@postgresql.org, pgsql-performance@postgresql.org Subject: Re: temporary indexes Message-ID: <20060228164515.GS82012@pervasive.com> References: <44041B68.EE98.0025.0@wicourts.gov> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <44041B68.EE98.0025.0@wicourts.gov> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060228:kevin.grittner@wicourts.gov::65RGNlrIQ+dTb0L2:0000000000 0000000000000000000000000GJd X-Hashcash: 1:20:060228:pgsql-hackers@postgresql.org::90rWyTQTqjhTpzNH:000000000 0000000000000000000000002R6p X-Hashcash: 1:20:060228:pgsql-performance@postgresql.org::gWXt308QpANvQGJy:00000 00000000000000000000000061Ko X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.105 required=5 tests=[AWL=0.105] X-Spam-Score: 0.105 X-Spam-Level: X-Archive-Number: 200602/1208 X-Sequence-Number: 80346 On Tue, Feb 28, 2006 at 09:44:08AM -0600, Kevin Grittner wrote: > It struck me that it would be outstanding if the planner could > recognize this sort of situation, and build a temporary index based on > the snapshot of the data visible to the transaction. It seems to me > that the obvious downside of this would be the explosion in the number > of permutations the planner would need to examine -- based not just on > what indexes ARE there, but which ones it could build. At a minimum, > there would need to be a cost threshold below which it would not even > consider the option. (In this case, as long as the optimizer spent less > than 13 hours and 50 minutes considering its options, we would have come > out ahead.) FWIW, Sybase supported something similar a long time ago. It had the ability to build a temporary 'clustered table' (think index organized table) when there was enough benefit to do so. This is actually much easier to make happen inside a transaction for us, because we don't need to keep visibility information around. There's probably also some index metadata that could be done away with. Perhaps the materialize node could be made to allow this. -- Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461