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 AA9389FAD5A for ; Fri, 15 Sep 2006 07:18:36 -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 43917-07-2 for ; Fri, 15 Sep 2006 10:18:27 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp-vbr3.xs4all.nl (smtp-vbr3.xs4all.nl [194.109.24.23]) by postgresql.org (Postfix) with ESMTP id DEDA59FB253 for ; Fri, 15 Sep 2006 07:18:26 -0300 (ADT) Received: from webmail.xs4all.nl (dovemail4.xs4all.nl [194.109.26.6]) by smtp-vbr3.xs4all.nl (8.13.6/8.13.6) with ESMTP id k8FAIOJX053126; Fri, 15 Sep 2006 12:18:24 +0200 (CEST) (envelope-from jtv@xs4all.nl) Received: from 203.121.164.162 (SquirrelMail authenticated user jtv) by webmail.xs4all.nl with HTTP; Fri, 15 Sep 2006 17:18:25 +0700 (ICT) Message-ID: <25525.203.121.164.162.1158315505.squirrel@webmail.xs4all.nl> In-Reply-To: <450A6A87.2030808@microbizz.nl> References: <450A6A87.2030808@microbizz.nl> Date: Fri, 15 Sep 2006 17:18:25 +0700 (ICT) Subject: Re: Progress of asynchronous queries From: "Jeroen T. Vermeulen" To: "Adriaan van Os" Cc: pgsql-interfaces@postgresql.org User-Agent: SquirrelMail/1.4.8 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by XS4ALL Virus Scanner X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.135 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200609/7 X-Sequence-Number: 6252 On Fri, September 15, 2006 15:55, 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. Jeroen