Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wc7IU-0005o5-SK for pgsql-jdbc@arkaria.postgresql.org; Mon, 21 Apr 2014 06:01:43 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Wc7IU-0002OV-9r for pgsql-jdbc@arkaria.postgresql.org; Mon, 21 Apr 2014 06:01:42 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wc7IT-0002OP-NK for pgsql-jdbc@postgresql.org; Mon, 21 Apr 2014 06:01:41 +0000 Received: from [2404:130:0:10::40:2] (helo=mail.catalyst.net.nz) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wc7IQ-0008VX-3r for pgsql-jdbc@postgresql.org; Mon, 21 Apr 2014 06:01:41 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.catalyst.net.nz (Postfix) with ESMTP id AFBF9330C0; Mon, 21 Apr 2014 18:01:36 +1200 (NZST) X-Virus-Scanned: Debian amavisd-new at catalyst.net.nz Received: from mail.catalyst.net.nz ([127.0.0.1]) by localhost (bertrand.catalyst.net.nz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VO78QOjiEYRX; Mon, 21 Apr 2014 18:01:32 +1200 (NZST) Received: from [192.168.1.64] (122-60-64-230.jetstream.xtra.co.nz [122.60.64.230]) (Authenticated sender: mark.kirkwood) by mail.catalyst.net.nz (Postfix) with ESMTPSA id 0DC0F32F40; Mon, 21 Apr 2014 18:01:32 +1200 (NZST) Message-ID: <5354B43B.6070102@catalyst.net.nz> Date: Mon, 21 Apr 2014 18:01:31 +1200 From: Mark Kirkwood User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: Dave Cramer , Sehrope Sarkuni CC: Dimitris Karampinas , "pgsql-jdbc@postgresql.org" Subject: Re: How to prevent jdbc from sending any results back to the client ? References: <8444AE81-E544-40D9-AB3B-6271261AED38@jackdb.com> <5354B0D3.2010900@catalyst.net.nz> In-Reply-To: <5354B0D3.2010900@catalyst.net.nz> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 2404:130:0:10::40:2 (failed) X-Pg-Spam-Score: -1.1 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org FWIW: the difference is noticeable, even on modern CPU types (this is an i7 4770): bench=# EXPLAIN (ANALYZE,TIMING FALSE) SELECT aid,bid FROM pgbench_accounts; QUERY PLAN -------------------------------------------------------------------------------------------------------- Seq Scan on pgbench_accounts (cost=0.00..26394.00 rows=1000000 width=8) (actual rows=1000000 loops=1) Planning time: 0.066 ms Total runtime: 80.172 ms (3 rows) bench=# EXPLAIN (ANALYZE,TIMING) SELECT aid,bid FROM pgbench_accounts; QUERY PLAN --------------------------------------------------------------------------------------------------------------------------- Seq Scan on pgbench_accounts (cost=0.00..26394.00 rows=1000000 width=8) (actual time=0.010..98.167 rows=1000000 loops=1) Planning time: 0.063 ms Total runtime: 124.818 ms (3 rows) On 21/04/14 17:46, Mark Kirkwood wrote: > One possible problem with using EXPLAIN ANALYZE is that the cost of > timing each step can artificially inflate the query time...however you > can avoid this by using the variant: > > EXPLAIN (ANALYZE,TIMING FALSE) statement > > Which still does the query, but skips timing each step (which I think > probably what you want). It still says how long the entire statement took. > > regards > > Mark > > > On 20/04/14 12:22, Dave Cramer wrote: >> Dimitris, >> >> You would be better off running queries such as explain analyze which do >> not return results, but do time the query. Every postgresql client >> library will have to wait for the results. That is essentially the way >> the protocol works >> >> Dave >> >> Dave Cramer >> >> dave.cramer(at)credativ(dot)ca >> http://www.credativ.ca >> >> >> On 19 April 2014 15:02, Sehrope Sarkuni > > wrote: >> >> The fetch size only comes into play if your are in a transaction. >> You have to disable auto commit and set the fetch size before >> executing your query. Otherwise the entire query result will be read >> and buffered in memory. >> >> An alternative is to run the command as an EXPLAIN ANALYZE[1]. The >> server will then execute the entire operation but instead of sending >> back the data it will send the query plan and runtime statistics. >> >> [1]: http://www.postgresql.org/docs/9.3/static/sql-explain.html >> >> Regards, >> Sehrope Sarkuni >> Founder & CEO | JackDB, Inc. | http://www.jackdb.com/ >> >> On Apr 19, 2014, at 2:48 PM, Dimitris Karampinas >> > wrote: >> >>> Hi, >>> >>> I'm working on an academic project and I need to benchmark >>> PostgreSQL. >>> I'm intersted only about the performance of the DBMS itself and >>> I'm trying to keep things simple in my measurements. >>> Preferably I'd like to ignore the query results at the client side >>> but jdbc seems to return results even if I don't call next() on >>> the Resultset (is that true ?). >>> As a consequence, I can't measure acurately a per query execution >>> time since the time I get depends also on the time spent to send >>> the answer (or part of it) to the client. >>> setFetchSize(1) doesn't seem to help much. >>> Can I hack the driver and diminish the overhead explained above ? >>> >>> Cheers, >>> Dimitris >> >> > > > -- Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-jdbc