X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 78355D1C4B8 for ; Fri, 15 Aug 2003 00:42:33 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 39822-04 for ; Thu, 14 Aug 2003 21:42:25 -0300 (ADT) Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) by svr1.postgresql.org (Postfix) with ESMTP id 542D4D1C4C7 for ; Thu, 14 Aug 2003 21:42:20 -0300 (ADT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id h7F0fqn08208; Thu, 14 Aug 2003 20:41:52 -0400 (EDT) From: Bruce Momjian Message-Id: <200308150041.h7F0fqn08208@candle.pha.pa.us> Subject: Re: 7.4 beta 1 getting out of swap In-Reply-To: <8826.1060906670@sss.pgh.pa.us> To: Tom Lane Date: Thu, 14 Aug 2003 20:41:52 -0400 (EDT) Cc: Bertrand Petit , Joe Conway , pgsql-hackers@postgresql.org X-Mailer: ELM [version 2.4ME+ PL99 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/782 X-Sequence-Number: 42439 > I can think of a number of ways we might attack this, but none seem > especially attractive --- > > 1. Have the index AMs create and switch into a special memory context > for each call, rather than running in the main execution context. > I am not sure this is workable at all, since the AMs tend to think they > can create data structures that will live across calls (for example a > btree lookup stack). It'd be the most general solution, if we could > make it work. > > 2. Modify the index AMs so that the comparison function FmgrInfo is > preserved across a whole query. I think this requires changes to the > index AM API (index_insert for instance has no provision for sharing > data across multiple calls). Messy, and would likely mean an initdb. > It would probably be the fastest answer though, since lookups wouldn't > need to be done more than once per query. #2 seems most natural in that it formalizes something that is common for lots of index methods. We are only in beta1, so I think we can initdb. > 3. Set up a long-lived cache internal to the array functions that can > translate element type OID to the needed lookup data, and won't leak > memory across repeated calls. This is not the fastest or most general > solution, but it seems the most localized and safest fix. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073