Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 8DFD11337BA6 for ; Mon, 4 Apr 2011 16:14:45 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 02922-07 for ; Mon, 4 Apr 2011 19:14:26 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.softperience.eu (static-ip-217-118-26-141.inaddr.intergenia.de [217.118.26.141]) by mail.postgresql.org (Postfix) with ESMTP id 002601337A5D for ; Mon, 4 Apr 2011 16:14:25 -0300 (ADT) Received: from radek.localnet (87-204-194-135.dg-net.pl [87.204.194.135]) by mail.softperience.eu (Postfix) with ESMTPA id 6C46DC000B0; Mon, 4 Apr 2011 21:14:22 +0200 (CEST) From: =?utf-8?q?Rados=C5=82aw_Smogura?= To: pgsql-jdbc@postgresql.org Subject: Re: JDBC gripe list Date: Mon, 4 Apr 2011 21:14:14 +0200 User-Agent: KMail/1.13.5 (Linux/2.6.36-gentoo-r8; KDE/4.4.5; x86_64; ; ) Cc: "Kevin Grittner" , pg@fastcrypt.com References: <4D8F25CE020000250003BCCA@gw.wicourts.gov> In-Reply-To: <4D8F25CE020000250003BCCA@gw.wicourts.gov> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201104042114.14227.rsmogura@softperience.eu> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201104/17 X-Sequence-Number: 21743 "Kevin Grittner" Sunday 27 March 2011 18:55:58 > > Dave Cramer wrote: > > > > Adding to the list is statement timeout. I seem to recall the issue > > is we do not want to spawn a thread for each statement which seems > > to be the only way to do this. Alternatively we could use timers, > > but I presume they just spawn threads as well. > > No, see the java.util.Timer docs: > > http://download.oracle.com/javase/6/docs/api/java/util/Timer.html > > Each Timer object uses one thread and can handle thousands of pending > timers. If you're using JDBC you're on a JVM, and those all know how > to multi-thread gracefully. A daemon thread for a group of timers > should be no big deal. > > We had a patch submitted for this, which looked to me like it was > pretty close to committable. I raised some concerns and was > intending to look at it again, but haven't gotten the requisite round > tuits yet. > > -Kevin If I good catched thread. I experimented with cursors, it's dead corner. Actually, if you have fetch size setted then cursors are used, but PG doesn't support scrollable & updatable cursors. From other hand about background fetching, You will need to fetch some good amount of rows, because of, mainly, network latency. Let's assume your latency is 2ms, and I'm looking for row witch id or something (number value) is 2, Java construct if (rs.getInt(1) == 2) takes less then 2 ms. Query will take much longer. If you ask for 10 rows, query time is at least 20ms - too bad. If you wan't to add positioned updates, then it's same problem you may move only forward. The fetch size is for databases that supports, hmm, prefetach, when you may download next xxx rows without moving cursor. I think PG can do it, but only in PgSQL. Regards, Radek