X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 78155D1B1D0 for ; Sun, 23 May 2004 13:28:46 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 67097-05 for ; Sun, 23 May 2004 13:28:26 -0300 (ADT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id E1AA1D1B192 for ; Sun, 23 May 2004 13:28:25 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i4NGSJfs024528; Sun, 23 May 2004 12:28:19 -0400 (EDT) To: "Alexander M. Pravking" Cc: pgsql-sql@postgresql.org Subject: Re: Memory usage on subselect In-reply-to: <20040522175419.GB54296@dyatel.antar.bryansk.ru> References: <20040522175419.GB54296@dyatel.antar.bryansk.ru> Comments: In-reply-to "Alexander M. Pravking" message dated "Sat, 22 May 2004 21:54:19 +0400" Date: Sun, 23 May 2004 12:28:18 -0400 Message-ID: <24527.1085329698@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/201 X-Sequence-Number: 17915 "Alexander M. Pravking" writes: > I've got a memory usage problem when I try to do a subselect on the same > table as the main select (PostgreSQL 7.3.4 on FreeBSD). Here's my query: > ... > The "services" table is indexed only on "id" column and has about a > thousand tuples. sreq(integer, text, timestamptz) is a strict immutable > function written in SQL. IIRC, there were intraquery memory leaks associated with SQL-language functions until fairly recently. Can you try your problem case on 7.4? Or see if you can rewrite the sreq function in plpgsql. regards, tom lane