Re: Cancelling Requests Frontend/Backend Protocol TCP/IP

From: John DeSoi <desoi(at)pgedit(dot)com>
To: Raimon Fernandez <coder(at)montx(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Cancelling Requests Frontend/Backend Protocol TCP/IP
Date: 2009-11-02 14:12:17
Message-ID: 1C213511-12C8-44F9-A33C-3033826133F3@pgedit.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-interfaces


On Nov 2, 2009, at 4:15 AM, Raimon Fernandez wrote:

> If for example I send a SELECT * from myTable, it has 20000 rows,
> and postgre starts sending the rows, how I can cancel this operation ?
>
> I thought Cancelling Requests would be perfect for this ... the
> workaround is closing and opening again the connection but I don't
> like this approach ...

A cleaner solution is to use the extended query protocol to limit the
total number of rows returned. For example, in my application I limit
the result set to 1000 rows. I have not received all of the results, I
switch to a server side cursor but still have the first 1000 rows for
immediate display to the end user.

John DeSoi, Ph.D.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Grant Masan 2009-11-02 14:16:15 Problem with database performance, Debian 4gb ram ?
Previous Message Ron Mayer 2009-11-02 14:06:39 Re: Absolute value of intervals

Browse pgsql-interfaces by date

  From Date Subject
Next Message Tom Lane 2009-11-02 14:38:00 Re: Cancelling Requests Frontend/Backend Protocol TCP/IP
Previous Message Alban Hertroys 2009-11-02 10:29:50 Re: DataRow Null values Frontend/Backend Protocol TCP/IP