Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1epKlX-00022J-Ep for pgsql-performance@arkaria.postgresql.org; Fri, 23 Feb 2018 21:20:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1epKlU-0004ki-BM for pgsql-performance@arkaria.postgresql.org; Fri, 23 Feb 2018 21:20:24 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1epKlU-0004kZ-1I for pgsql-performance@lists.postgresql.org; Fri, 23 Feb 2018 21:20:24 +0000 Received: from mail.i-mark.de ([188.138.104.222]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1epKlQ-0002cB-Pf for pgsql-performance@lists.postgresql.org; Fri, 23 Feb 2018 21:20:22 +0000 Received: from [192.168.222.106] (p5B31311B.dip0.t-ipconnect.de [91.49.49.27]) by mail.i-mark.de (Postfix) with ESMTPSA id 06CD71580AB2 for ; Fri, 23 Feb 2018 22:20:11 +0100 (CET) Authentication-Results: loft7616.startdedicated.de; spf=pass (sender IP is 91.49.49.27) smtp.mailfrom=andreas@a-kretschmer.de smtp.helo=[192.168.222.106] Received-SPF: pass (loft7616.startdedicated.de: connection is authenticated) Subject: Re: Performance To: pgsql-performance@lists.postgresql.org References: <20180223192638.GM2416@tamriel.snowman.net> From: Andreas Kretschmer Message-ID: <04a2e637-0d72-d069-c2ee-7cee12eec90a@a-kretschmer.de> Date: Fri, 23 Feb 2018 22:20:15 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Am 23.02.2018 um 20:29 schrieb Daulat Ram: > We have the following requirements in single query or any proper solution. Please help on this. > How many sessions are currently opened. ask pg_stat_activity, via select * from pg_stat_activity > -and if opened then how many queries have executed on that session. Whot? There isn't a counter for that, AFAIK. > -and also we have to trace how much time each query is taking. You can use auto_explain for that > -and also we have to find the cost of each query. the same, auto_explain please keep in mind: costs are imaginary. Regards, Andreas -- 2ndQuadrant - The PostgreSQL Support Company. www.2ndQuadrant.com