Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1onhhK-0002fb-Ra for pgsql-general@arkaria.postgresql.org; Wed, 26 Oct 2022 14:48:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1onhhJ-0005q8-Mc for pgsql-general@arkaria.postgresql.org; Wed, 26 Oct 2022 14:48:01 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1onhhJ-0005py-7o for pgsql-general@lists.postgresql.org; Wed, 26 Oct 2022 14:48:01 +0000 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1onhhG-0008Qr-QX for pgsql-general@lists.postgresql.org; Wed, 26 Oct 2022 14:48:00 +0000 Received: by mail-pj1-x1031.google.com with SMTP id u8-20020a17090a5e4800b002106dcdd4a0so2749454pji.1 for ; Wed, 26 Oct 2022 07:47:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:from:content-language:references:to:subject:user-agent :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=EzRKE1x+UvsVEQ/MEO540a8RICrwTIVD4oyQTqppkoI=; b=UbGNB0Ts4ILbas9fyce5c5VWMI3SUwLguSF9WAAL9pLCG8LLDED+LC0WqQR6tla1ew PQlOT8jJ3RErqTZ2H+lm04lLe8HP2+NfG8HztRxWMnaDe0LJKswNGMiESoNr0JyUTDvu +QvMDDhyl9ke7VWJ/E8YryR5hDtbu5DMjzSGcCDK2kf/JRmlSuh26Q7lTDSa2ooq/l+H V7z7bl3bL8VvbvUZ+UyCHzr4UdveQxNmU+grv3zN00i08hwCP4ROJuwou9Wj2MboPRjD 9nPY+ulOz+zykpNKZ4Zyqi9xOx4umnGAsapmqM9XE9teg1g/Wa1QiTO8burO1X0OgkVl sFGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:from:content-language:references:to:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=EzRKE1x+UvsVEQ/MEO540a8RICrwTIVD4oyQTqppkoI=; b=5+ESp4K9uk9SgHnaU7Q4qR3ArXsqb00ZKmG0OCkp5RPBuLS5kqVVZ8s1fxiqSQ3NhX btZWBNkv1TIh940Et2pMNLZHv4606c/VLb1a3j1fIZs5TH9Zj6PPQtG3eky17zZ68dfO 2ZOVusuYQF/4Yp3uMsOk3rWJe6wKtfZI2HUJHqglKR8ykeGQpIQYOCNUJJ3XqOCEzqz6 m1wC8DSzSB3Z9RdNFOYLv4wYIkSOhtIruxooSUah/DsSt7nDKkbpKZb7W92CgNuhG2GK C8SRXTFOMBbEe8MzmE0oWZbVfq9DU1jN58fOgKrZbyWr1JvumgC49hZffz4QUsFVn5Go qrCw== X-Gm-Message-State: ACrzQf1UEeuO3g6XVnbQhiWgz9ouaTAA3+v+kUaC1hepRkmbij33tcJY NUaSPoh3JPfcTQAntLe1Fj+jb8a+/U8= X-Google-Smtp-Source: AMsMyM5IMbKRKmUSACXNz5GjqMDudvl5Nn1VsEwu/3osZwLd96FSt9syoMf9RVIF3hz/DVlZMPuJyg== X-Received: by 2002:a17:902:f551:b0:186:be04:6670 with SMTP id h17-20020a170902f55100b00186be046670mr10649736plf.159.1666795676619; Wed, 26 Oct 2022 07:47:56 -0700 (PDT) Received: from [10.128.56.136] ([155.98.131.0]) by smtp.gmail.com with ESMTPSA id x5-20020a17090300c500b0017d97d13b18sm3001024plc.65.2022.10.26.07.47.55 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 26 Oct 2022 07:47:56 -0700 (PDT) Content-Type: multipart/alternative; boundary="------------P0VzkxUwjdjseiCogPrxefbP" Message-ID: Date: Wed, 26 Oct 2022 08:47:54 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: How to know how much CPU, RAM is used by existing 1 database To: pgsql-general@lists.postgresql.org References: Content-Language: en-CA From: Rob Sargent In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------P0VzkxUwjdjseiCogPrxefbP Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 10/26/22 08:26, Yi Sun wrote: > > > On Wed, 26 Oct 2022 at 18:10, jian he wrote: > > > > On Wed, Oct 26, 2022 at 11:07 AM Yi Sun wrote: > > Hi Guys, > > Who can help me with this please? I researched but still no > result yet, thank you > > On Tue, 25 Oct 2022 at 16:30, Yi Sun wrote: > > Hi, > > There are many databases in our production patroni cluster > and it seems it is overloaded, so we decide to migrate the > busiest database to a new patroni cluster. > > pgwatch2 is implemented, how to know how much CPU, RAM is > used by the database please? Then we can use it to prepare > the new patroni cluster hardware. Thank you > > Best regards > Dennis > > > manual: > https://www.postgresql.org/docs/current/runtime-config-resource.html| > | > |except |min_dynamic_shared_memory| (|integer|)| > |all other parameters are used to cap the memory. almost all > parameters mentioned "database server" which means it's on cluster > level. > | > | > | > | > | > -- >  I recommend David Deutsch's <> > >   Jian > > > >  Hi Jian he > > Thank you for your reply > > The parameters are on cluster level, so we still can not know how much > memory is used in a specific database, for example, total memory is 64GB > 1. How to get how much memory is used on cluster level? For example 40GB > 2. How to get how much memory is used in a specific database? For > example 30GB, then we can prepare the new patroni cluster 32GB is enough > > Thank you > Dennis You can see connection with pg*backend* functions.  You can log connections to see which db is most commonly accessed. You can log sql to see which table are being touched.  You'll have to assume a correlation to CPU/disc usage.  What have you tried? --------------P0VzkxUwjdjseiCogPrxefbP Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit
On 10/26/22 08:26, Yi Sun wrote:


On Wed, 26 Oct 2022 at 18:10, jian he <jian.universality@gmail.com> wrote:


On Wed, Oct 26, 2022 at 11:07 AM Yi Sun <yinan81@gmail.com> wrote:
Hi Guys,

Who can help me with this please? I researched but still no result yet, thank you

On Tue, 25 Oct 2022 at 16:30, Yi Sun <yinan81@gmail.com> wrote:
Hi,

There are many databases in our production patroni cluster and it seems it is overloaded, so we decide to migrate the busiest database to a new patroni cluster. 

pgwatch2 is implemented, how to know how much CPU, RAM is used by the database please? Then we can use it to prepare the new patroni cluster hardware. Thank you

Best regards
Dennis

except min_dynamic_shared_memory (integer)
all other parameters are used to cap the memory. almost all parameters mentioned "database server" which means it's on cluster level.


--
 I recommend David Deutsch's <<The Beginning of Infinity>>

  Jian



 Hi Jian he

Thank you for your reply

The parameters are on cluster level, so we still can not know how much memory is used in a specific database, for example, total memory is 64GB
1. How to get how much memory is used on cluster level? For example 40GB
2. How to get how much memory is used in a specific database? For example 30GB, then we can prepare the new patroni cluster 32GB is enough

Thank you
Dennis
You can see connection with pg*backend* functions.  You can log connections to see which db is most commonly accessed. You can log sql to see which table are being touched.  You'll have to assume a correlation to CPU/disc usage.  What have you tried?
--------------P0VzkxUwjdjseiCogPrxefbP--