agora inbox for pgsql-interfaces@postgresql.org  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@commandprompt.com>
To: Raimon Fernandez <coder@montx.com>
Cc: pgsql-general@postgresql.org
Subject: Re: Implementing Frontend/Backend Protocol TCP/IP
Date: Tue, 27 Oct 2009 10:00:09 -0300
Message-ID: <20091027130008.GA4876@alvh.no-ip.org> (raw)
In-Reply-To: <F9B13903-C8D7-4A92-825D-EB12FE646A63@montx.com>
References: <92781008-8A70-42CE-A49B-6EE67103FACB@montx.com>
	<FC6CBC8C-A398-4835-B3A3-C16C6F4F62D9@pgedit.com>
	<E084987E-A212-4B70-8CFF-D83AA00629C5@montx.com>
	<C670629A-1E54-4F80-9497-6CCAC1A8BDC0@montx.com>
	<20091026231516.GN8812@alvh.no-ip.org>
	<4AE62E21.7040600@hogranch.com>
	<F9B13903-C8D7-4A92-825D-EB12FE646A63@montx.com>

Raimon Fernandez wrote:

> REALbasic has plugin for PostgreSQL, but they are synchronous  and
> freeze the GUI when interacting with PG. This is not a problem
> noramlly, as the SELECTS/UPDATES/... are fast enopugh, but sometimes
> we need to fetch 1000, 5000 or more rows and the application stops
> to respond, I can't have a progressbar because all is freeze, until
> all data has come from PG, so we need a better way.

If you need to fetch large numbers of rows, perhaps it would be better
to use a cursor and fetch a few at a time, moving the progress bar in
the pauses.  So instead of

SELECT * FROM sometab;

you would o
DECLARE foo CURSOR FOR SELECT * FROM sometab;

and then, repeatedly,
FETCH 50 FROM foo

Until there are no more rows.

This can still freeze your app in certain cases, but it will be probably
a lot better than what you currently have.  And it will be MUCH easier/
cheaper to do than working with the FE/BE protocol yourself.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support



view thread (20+ messages)  latest in thread

Message-ID: <20091027130008.GA4876@alvh.no-ip.org>
Permalink:  ../20091027130008.GA4876@alvh.no-ip.org/
Also on:    postgresql.org/message-id/20091027130008.GA4876@alvh.no-ip.org

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: alvherre@commandprompt.com, coder@montx.com, pgsql-general@postgresql.org
  Subject: Re: Implementing Frontend/Backend Protocol TCP/IP
  In-Reply-To: <20091027130008.GA4876@alvh.no-ip.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox