X-Original-To: pgsql-interfaces-postgresql.org@postgresql.org Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id D34B29FB2A3 for ; Fri, 15 Sep 2006 09:56:34 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 80481-09 for ; Fri, 15 Sep 2006 12:56:24 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp14.wxs.nl (smtp14.wxs.nl [195.121.247.5]) by postgresql.org (Postfix) with ESMTP id 145469FB29F for ; Fri, 15 Sep 2006 09:56:23 -0300 (ADT) Received: from [195.121.56.84] (ipc3793854.dial.planet.nl [195.121.56.84]) by smtp14.wxs.nl (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTP id <0J5M00LUNX9IJD@smtp14.wxs.nl> for pgsql-interfaces@postgresql.org; Fri, 15 Sep 2006 14:56:07 +0200 (CEST) Date: Fri, 15 Sep 2006 14:56:33 +0200 From: Adriaan van Os Subject: Re: Progress of asynchronous queries In-reply-to: <450A6A87.2030808@microbizz.nl> To: pgsql-interfaces@postgresql.org Message-id: <450AA301.9020408@microbizz.nl> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7BIT User-Agent: Thunderbird 1.5.0.4 (Macintosh/20060516) References: <450A6A87.2030808@microbizz.nl> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200609/8 X-Sequence-Number: 6253 Jeroen T. Vermeulen wrote: > Adriaan van Os wrote: >> I couldn't find anything in the libpq interfaces that identifies the >> current progress of an >> asynchronous query as a percentage of the estimated total query time. So, >> unless I missed >> something, I would like to file this as a feature request. >> >> The idea behind this, of course, is to show a progress bar in the user >> interface of the client >> application as soon as the query takes longer than say 1 second. > > One way to do this would be to use a cursor, and only receive batches of > (say) a hundred or a thousand rows at a time. In that case you might not > even want to bother with asynchronous execution at all. > > It may take some extra work for your program to handle its data in chunks. > Then again, for many programs it's not necessary to hold all of a result > set in memory at the same time. In that case you may see reduced memory > usage if you request one chunk of data through a cursor, process it, then > request the next batch. > > Doing that will take longer overall but give you faster initial response > time. If you want to keep the overall time low, and you do a lot of > processing per batch, you may still want to request your batches > asynchronously just so your program can process one batch of data while > the server is retrieving the next. Thanks for your reply and the idea to process data in chunks. Still, I feel that a workaround for some situations (that may not work in others) is not in general a good replacement for a fundamental feature, as keeping the user informed is one of principles of User Interface design . Besides, when more than one user is connected, multiple SQL commands may behave different than a single SQL command () Regards, Adriaan van Os