Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 808446329AF for ; Tue, 27 Oct 2009 10:00:36 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 03381-06 for ; Tue, 27 Oct 2009 13:00:17 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from spinlock.commandprompt.com (host-215.commandprompt.net [207.173.203.215]) by mail.postgresql.org (Postfix) with ESMTP id C4E956326C2 for ; Tue, 27 Oct 2009 10:00:14 -0300 (ADT) Received: from perhan.alvh.no-ip.org (200-126-87-11.bk6-dsl.surnet.cl [200.126.87.11]) by spinlock.commandprompt.com (Postfix) with ESMTPSA id 21B5C348034; Tue, 27 Oct 2009 06:00:08 -0700 (PDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 2D6546E31F; Tue, 27 Oct 2009 10:00:09 -0300 (CLST) Date: Tue, 27 Oct 2009 10:00:09 -0300 From: Alvaro Herrera To: Raimon Fernandez Cc: pgsql-general@postgresql.org Subject: Re: Implementing Frontend/Backend Protocol TCP/IP Message-ID: <20091027130008.GA4876@alvh.no-ip.org> References: <92781008-8A70-42CE-A49B-6EE67103FACB@montx.com> <20091026231516.GN8812@alvh.no-ip.org> <4AE62E21.7040600@hogranch.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.571 tagged_above=-10 required=5 tests=AWL=0.028, BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200910/1029 X-Sequence-Number: 154723 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