Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h1fME-0004FA-8X for pgsql-performance@arkaria.postgresql.org; Wed, 06 Mar 2019 22:49:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h1fMC-0002m1-16 for pgsql-performance@arkaria.postgresql.org; Wed, 06 Mar 2019 22:49:48 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h1fMB-0002lp-0R for pgsql-performance@lists.postgresql.org; Wed, 06 Mar 2019 22:49:47 +0000 Received: from mail-it1-x144.google.com ([2607:f8b0:4864:20::144]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h1fL9-0007EQ-It for pgsql-performance@postgresql.org; Wed, 06 Mar 2019 22:49:45 +0000 Received: by mail-it1-x144.google.com with SMTP id l15so12782583iti.4 for ; Wed, 06 Mar 2019 14:48:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=CvaxcrEoa1t54VrOx6lPJR6TxHcNa+ueW0h8EF6DKeY=; b=G4Ck0uT60q+awVemuwQVOdZUC73OgakBWDyXBh2s1jC5zcDHcVmZWJbLyRmvdMUdin Sh40kCNKYbBi53qRfrJr7HP/nmxXquH8nk0NX18UgzKDW+jXcHWA5w4Inwjtx0QNHA77 cVDk+ed6M2KVrWqsse3XSOXwNcT7D87dAv6ksJdFUk8ki/d8cLZhjIrXbP+PTbs4Zl6Z 4E/n2+YNu0Ax8x1i1l7KVyYbY0Df65Kp5k7sz12CQErR0VU/MKkfbYVR1mgCwlKwmm+s 2kWZg5n0ppVWh7rWtLVzigIzx2sRtEgsr3U2wfirbF0MrK5nA7j6CyE7IA+pfuOW6j7b CI7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=CvaxcrEoa1t54VrOx6lPJR6TxHcNa+ueW0h8EF6DKeY=; b=sIDgJ8sfYUVUIb58BqAetxiiOFHJja+H7STr7l5FUeyiv94uFsB49YXLmgeZpxFnry TUPso5Bx5bn2gWHHgftX82lVBRdKobnF3rdvHTqxNLqhhr34pS8NqBn9d1V+FiZVRcS9 d8b5H1NKUUbKo05cxg4IcdOQ7OVCVjMsz6lx3fbCOYpKiV2yaSJRFPcBOA9V2qkQJUiu /cYdCbysdfgkOhH2pQkHSKeJOaLGTwpS0+yA77kW2kCmVwgixvSTOCjzI1njjIefg1O/ gKKFR0WyJyA1R4rK6IY0E0YldkFO1jLSj4XG3TmWWlHbDWxx5yiS7w1wrSUWWAeh1SvY e66Q== X-Gm-Message-State: APjAAAUS7hxmhCgXLZ2rBHNF8pHOsmS4W145tY7+xsUnZVOctL/AFGbG H8d+SK38+oR9snSTDWsh6bYhzA== X-Google-Smtp-Source: APXvYqx9XWtBxiLtBCdUApGPL9dDmWjruhQsgLVDpNDIkEQWqxy8YGBcE15SfCwrXhiEX1WpRgvjMg== X-Received: by 2002:a24:f804:: with SMTP id a4mr3029200ith.2.1551912522709; Wed, 06 Mar 2019 14:48:42 -0800 (PST) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id x7sm1073247ioh.51.2019.03.06.14.48.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Mar 2019 14:48:42 -0800 (PST) Received: by pryzbyj (Postfix, from userid 1000) id D5A38800C83; Wed, 6 Mar 2019 16:48:40 -0600 (CST) Date: Wed, 6 Mar 2019 16:48:40 -0600 From: Justin Pryzby To: Kenia Vergara Cc: pgsql-performance@postgresql.org Subject: rusage (Re: Good afternoon.) Message-ID: <20190306224840.GB29584@telsasoft.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, On Wed, Mar 06, 2019 at 04:09:46PM -0400, Kenia Vergara wrote: > Good afternoon. > I need to know the commands to display the execution time, CPU usage and > memory usage, but through the Postgres console.Thank you. Does this do what you want ? Note that the "QUERY STATISTICS" are log output, and not a part of the sql result. $ psql postgres -Atc "SET client_min_messages=log; SET log_statement_stats=on" -c 'explain analyze SELECT max(i) FROM generate_series(1,999999)i' SET LOG: QUERY STATISTICS DETAIL: ! system usage stats: ! 0.625402 s user, 0.059799 s system, 0.687496 s elapsed ! [0.629882 s user, 0.059799 s system total] ! 10672 kB max resident size ! 0/27344 [0/27344] filesystem blocks in/out ! 0/1378 [0/2365] page faults/reclaims, 0 [0] swaps ! 0 [0] signals rcvd, 0/0 [0/0] messages rcvd/sent ! 0/167 [2/167] voluntary/involuntary context switches Aggregate (cost=12.50..12.51 rows=1 width=4) (actual time=680.155..680.161 rows=1 loops=1) -> Function Scan on generate_series i (cost=0.00..10.00 rows=1000 width=4) (actual time=253.512..497.462 rows=999999 loops=1) Planning Time: 0.227 ms Execution Time: 686.200 ms Justin