Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t0ur3-00Dn6m-Th for pgsql-admin@arkaria.postgresql.org; Wed, 16 Oct 2024 03:37:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1t0ur1-00F2gd-G0 for pgsql-admin@arkaria.postgresql.org; Wed, 16 Oct 2024 03:37:43 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t0ur1-00F2gT-3d for pgsql-admin@lists.postgresql.org; Wed, 16 Oct 2024 03:37:43 +0000 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1t0uqz-001I05-7m for pgsql-admin@lists.postgresql.org; Wed, 16 Oct 2024 03:37:42 +0000 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-71e585ef0b3so2474151b3a.1 for ; Tue, 15 Oct 2024 20:37:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729049859; x=1729654659; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Gbw38VYbeS3sGsGUIRnrOCN4sKrzZMDv7yw3OFwpNk4=; b=dQtGuZkT+tXNlau/5S1mGfNBRxrbBbXdMJ+rKvkO785NMiwqVRLBdZ3LRtD4+j54Ky /8YjsEoeB2uH9jZUYeYEXVufaS8RAwLKp20G+Z/UpImJ9pcW6NVu5fGzouFllouwHlcd rzaJk8qfFQRQ4NFs/1qK6lGQ9AVYPZujVPjxCY0QyxCZ7vWT9IF0xoC/hOGpKQ5ODBcI H/37eFwdbYd6iOx+qi4LmYSca9q4n5yY1Fx6R0Um1K1MH7tCRn2J3KnTa8xUjxfmzGGD h1vXVll41AIsgiaXBTt72MtFpDOBjK04Pi+Jk0tKnEt2H2hVDLdYPgWOlct3bsZDMzuk eryQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729049859; x=1729654659; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Gbw38VYbeS3sGsGUIRnrOCN4sKrzZMDv7yw3OFwpNk4=; b=jK104UvLCjcLpcxolmGvZJVcex1qsmAs+oIsXs/Alaz9jPhzJeIrB4P+wFDmayv4pa 8Y8m1yRsscgUsYuz0wf+WP/pnkwAp+Gg098bdelda9xf8ATPYYRZFX4zP5KhUy2Naa0e CogsRBeC2HXflISpj5ofJXSY/272i5xU5RXtSNls/tHTEzAwxgyj+hWOJIHzzhxNB+y/ qydb3Y0+MQRMARgArbY1ZI2GPRKe62WF+EJmyUK8E+PrqxrX3/FkMp60CEOpxKD6SBjS C9f2KXLRxIizgEKmeZmq4t1SEswl5xrHB+kMDU92ENZX1Wc574sy6MYRbUOeQ3ItOEcG FPZw== X-Gm-Message-State: AOJu0YyyHi6HnyyjjQGccTF8A/DtynYNaKZW878pwefWzdfUNTGPlcAo FcW7jqhhqgU67uZhIISZCfZRWxQXCYuu/RhfUvrXOClP7EIzaEPu5QiQvZIuL36abS8eVo4MM2+ PQKIZlTDEApat4lQGU1p29WdZ3cFGMZBJ X-Google-Smtp-Source: AGHT+IH6GCNkG8zehDxnQk59REAvAOxvHjf6hDfJm5/kiYDYMCWrc+fYrdMiNQWQ2kSDG40ZUQPv6yrXbBOmSUFjL3A= X-Received: by 2002:aa7:93bc:0:b0:71e:5b0e:a5e4 with SMTP id d2e1a72fcca58-71e5b0ea793mr12626276b3a.27.1729049859117; Tue, 15 Oct 2024 20:37:39 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Muhammad Ikram Date: Wed, 16 Oct 2024 08:37:27 +0500 Message-ID: Subject: Re: work_mem memory usage statistics To: Loles Cc: Pgsql-admin Content-Type: multipart/alternative; boundary="000000000000a6dc6306248fca0c" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000a6dc6306248fca0c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, - No built-in routine or extension is there to show aggregation of work_mem for any query, as it is dynamically allocated. - If work_mem requirement exceeds then it spills to disk, which can be monitored through logs. Use log_temp_files and log_statement_stats to see temp files, their size may give clues. - pg_stat_statements and pg_stat_activity may also help in getting an idea about which queries are taking more time and their consumption of shared blocks etc. Regards, Ikram On Tue, Oct 15, 2024 at 11:46=E2=80=AFPM Loles wrote: > Hi team, > > Is there any statistics table or view in the PostgreSQL catalog, > extension, or similar that collects and displays work_mem memory usage > statistics? It would be interesting to know the use of the work_mem by > user, application and/or database. > > Thanks in advance. > > Loles > --000000000000a6dc6306248fca0c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Hi,

- No built-in routine or extension is= there to show aggregation of work_mem for any query, as it is dynamically = allocated.
- If work_mem requirement exceeds then it spills to disk, whi= ch can be monitored through logs. Use log_temp_files and log_statement_stat= s to see temp files, their size may give clues.
- pg_stat_statements and= pg_stat_activity may also help in getting an idea about which queries are = taking more time and their consumption of shared blocks etc.

Regards= ,
Ikram

On Tue, Oct 15, 2024 at 11:46=E2=80=AFPM Loles &l= t;lolesft@gmail.com> wrote:
=
Hi team,

Is there any statistics table or view in th= e PostgreSQL catalog, extension, or similar that collects and displays work= _mem memory usage statistics? It would be interesting to know the use of th= e work_mem by user, application and/or database.

Thanks = in advance.

Loles
--000000000000a6dc6306248fca0c--