Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id EBCF1B60EAA; Thu, 2 Jun 2011 13:12:20 -0300 (ADT) 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 16775-02; Thu, 2 Jun 2011 16:12:13 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.esilo.com (ns1.esilo.com [63.150.152.211]) by mail.postgresql.org (Postfix) with ESMTP id ABB04B60A4D; Thu, 2 Jun 2011 13:12:13 -0300 (ADT) Received: from [10.0.0.2] (fwext-esilo-jupiter.esilo.com [173.162.79.161]) (authenticated bits=0) by mail.esilo.com (8.13.1/8.13.1) with ESMTP id p52GC8kq005326 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO); Thu, 2 Jun 2011 12:12:09 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=simple/simple; d=esilo.com; s=200912; t=1307031129; bh=1/6xlF9a5KLFBr42LEShFHTUjEs=; h=Message-ID:Date:From:MIME-Version:To:CC:Subject:References: In-Reply-To:Content-Type:Content-Transfer-Encoding; b=WcB0HDQLv/t5GepDh9B9eKHo8dDLcm2z1jKC1ONnuOefGFm8yumtzmH1Jn/GMepFh E0ryYPTDgenFG1V4/9h6sY6elqhhiQDidy4C3GYFx/fHKWCvzzbonpk2C+gTUbZtsX feNgqYB3emhQ1H5Dadrk8ZoScAFBDnSZsmRFG5zw= DomainKey-Signature: a=rsa-sha1; s=main; d=esilo.com; c=simple; q=dns; b=CQqI6qSzRQWCHlvtEOy/U1EvnJ6rFNHzQc/0ut0ME6pkKiRbvpRHwChOpVkQASPSV V7kqxUb8zVk0AGUfHkyAg== Message-ID: <4DE7B660.8040704@esilo.com> Date: Thu, 02 Jun 2011 12:12:16 -0400 From: Andrew Chernow User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 MIME-Version: 1.0 To: Alvaro Herrera CC: Pavel Golub , Pavel Golub , PostgreSQL Hackers , pgsql-interfaces Subject: Re: PQdeleteTuple function in libpq References: <147534417.20110601184310@gf.microolap.com> <4DE6A5B7.2070700@esilo.com> <707574086.20110602112826@gf.microolap.com> <4DE79A58.4010608@esilo.com> <1307026778-sup-415@alvh.no-ip.org> In-Reply-To: <1307026778-sup-415@alvh.no-ip.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201106/148 X-Sequence-Number: 188861 On 6/2/2011 11:02 AM, Alvaro Herrera wrote: > Excerpts from Andrew Chernow's message of jue jun 02 10:12:40 -0400 2011: > >>> Andrew, why we have PQmakeEmptyPGresult, PQcopyResult, >>> PQsetResultAttrs, PQsetvalue and PQresultAlloc in this case? Of course >>> there's no big deal with their absence but let's be consistent. >> >> I'm not entirely sure what you are trying to do, but can't you use >> PQmakeEmptyPGresult, PQsetResultAttrs and PQsetvalue to construct a >> result that excludes the tuples you don't want followed by a >> PQclear(initial_result)? > > Seems pretty wasteful if you want to delete a single tuple from a large > result. I think if you desired to compact the result to free some > memory after deleting a large fraction of the tuples in the result it > could be useful to do that, otherwise just live with the unused holes in > the storage area as suggested by Pavel. > Another solution is to manually cursor through the set (like grab 1000 tuples at a time) and copy the set to your own structure. That way, the temporary double memory to perform the copy is not as big of a hit. By using your own structure, you can organize the memory in a fashion that is optimized for your requirement. -- Andrew Chernow eSilo, LLC global backup http://www.esilo.com/