Re: PQdeleteTuple function in libpq

From: Andrew Chernow <ac(at)esilo(dot)com>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Pavel Golub <pavel(at)gf(dot)microolap(dot)com>, Pavel Golub <pavel(at)microolap(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, pgsql-interfaces <pgsql-interfaces(at)postgresql(dot)org>
Subject: Re: PQdeleteTuple function in libpq
Date: 2011-06-02 16:12:16
Message-ID: 4DE7B660.8040704@esilo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-interfaces

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/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2011-06-02 16:20:53 Re: Please test peer (socket ident) auth on *BSD
Previous Message Merlin Moncure 2011-06-02 16:05:47 Re: PQdeleteTuple function in libpq

Browse pgsql-interfaces by date

  From Date Subject
Next Message Pavel Golub 2011-06-03 05:54:13 Re: [HACKERS] PQdeleteTuple function in libpq
Previous Message Merlin Moncure 2011-06-02 16:05:47 Re: PQdeleteTuple function in libpq