Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 5A2DFB5DBC8 for ; Sun, 10 Jul 2011 19:21:08 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 08536-01 for ; Sun, 10 Jul 2011 22:20:57 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from www.postnewspapers.com.au (www.postnewspapers.com.au [173.230.139.50]) by mail.postgresql.org (Postfix) with ESMTP id B1837B5DBBE for ; Sun, 10 Jul 2011 19:20:54 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by www.postnewspapers.com.au (Postfix) with ESMTP id F0186EB; Sun, 10 Jul 2011 18:20:53 -0400 (EDT) X-Virus-Scanned: amavisd-new at postnewspapers.com.au.com Received: from www.postnewspapers.com.au ([127.0.0.1]) by localhost (www.postnewspapers.com.au [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 9sL66mSPtWAT; Sun, 10 Jul 2011 18:20:53 -0400 (EDT) Received: from mail.postnewspapers.com.au (ppp171-128.static.internode.on.net [150.101.171.128]) by www.postnewspapers.com.au (Postfix) with ESMTP id B573627; Sun, 10 Jul 2011 18:20:52 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.postnewspapers.com.au (Postfix) with ESMTP id 0221AAF7DA; Mon, 11 Jul 2011 06:20:51 +0800 (WST) X-Amavis-Modified: Mail body modified (using disclaimer) - mail.postnewspapers.com.au X-Virus-Scanned: Debian amavisd-new at postnewspapers.com.au Received: from mail.postnewspapers.com.au ([127.0.0.1]) by localhost (mail.postnewspapers.com.au [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 3LfgR0HPA7Pi; Mon, 11 Jul 2011 06:20:46 +0800 (WST) Received: from [10.1.1.8] (58-7-210-8.dyn.iinet.net.au [58.7.210.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "Craig Ringer", Issuer "POST Certificate Authority" (verified OK)) by mail.postnewspapers.com.au (Postfix) with ESMTPSA id 2D98CAF7D5; Mon, 11 Jul 2011 06:20:46 +0800 (WST) Message-ID: <4E1A25BD.2080905@postnewspapers.com.au> Date: Mon, 11 Jul 2011 06:20:45 +0800 From: Craig Ringer User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20110624 Thunderbird/5.0 MIME-Version: 1.0 To: Radhya sahal CC: pgsql-performance group Subject: Re: query total time im milliseconds References: <1310303281.47662.YahooMailRC@web38607.mail.mud.yahoo.com> In-Reply-To: <1310303281.47662.YahooMailRC@web38607.mail.mud.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201107/90 X-Sequence-Number: 44302 On 10/07/2011 9:08 PM, Radhya sahal wrote: > > Dear all , > could any one help me? > when i use pgadmin to exceute a query it shows the total time for query .. > such as > (select * form table_name.........)query total time is for example 100 ms > i want to know the command that can retetive the query total time in > millisecond > if i connect with postgresql from java using JDBC > i need the query total time necessary to use it in my project > i don't want run explian,explain gives estimated i want real total time > for the query Record the value of System.currentTimeMillis() or System.nanoTime(). Run your query. Subtract the recorded value from the current value of System.currentTimeMillis() or System.nanoTime() to get the execution time including how long the query took to transfer data from the server to your client. I'm not aware of a way to find out how long the query took to execute on the server - excluding data transfer to the client - without using EXPLAIN ANALYZE. -- Craig Ringer POST Newspapers 276 Onslow Rd, Shenton Park Ph: 08 9381 3088 Fax: 08 9388 2258 ABN: 50 008 917 717 http://www.postnewspapers.com.au/