Re: Fetch zero result rows when executing a query?

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Shay Rojansky <roji(at)roji(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Fetch zero result rows when executing a query?
Date: 2015-02-03 11:31:12
Message-ID: 20150203113112.GH25227@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2015-02-03 12:26:33 +0100, Shay Rojansky wrote:
> Sorry if this has been asked before, couldn't find any mention...
>
> I'm working on the Npgsql, the .NET driver for PostgreSQL, and am trying to
> find a way to execute a query but without fetching any rows. The Execute
> message has a maximum result-row count, but zero is documented to mean
> "fetch all rows".
>
> The use case would be sending a query which might modify or might not (e.g.
> UPDATE), but we know that the user is uninterested in any result row.
>
> My current workaround is to specify maxrows=1, was wondering if I missed a
> better alternative.

Is this really a relevant optimization? If the user doesn't want
results, RETURNING shouldn't be specified... Sure, sometimes the same
query will be reused over cases where you want the results and those
where you don't, but I doubt this is worthy of optimization.

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2015-02-03 12:11:15 Re: PageRepairFragmentation performance
Previous Message Shay Rojansky 2015-02-03 11:26:33 Fetch zero result rows when executing a query?