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 1sotgN-00Ed9f-Lj for pgsql-admin@arkaria.postgresql.org; Thu, 12 Sep 2024 23:57:04 +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 1sotgL-0048k8-V7 for pgsql-admin@arkaria.postgresql.org; Thu, 12 Sep 2024 23:57:01 +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 1sotgL-0048k0-JE for pgsql-admin@lists.postgresql.org; Thu, 12 Sep 2024 23:57:01 +0000 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sotgI-000tYS-5e for pgsql-admin@postgresql.org; Thu, 12 Sep 2024 23:57:01 +0000 Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-5c3c30e6649so1671651a12.2 for ; Thu, 12 Sep 2024 16:56:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726185418; x=1726790218; darn=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=TWgFsEv6ZnvDTK2SzOTRT82/EbmDTMjLadAnVDO4e1w=; b=P7/xdI9nPnWag7vWXmLMSt12k+qUQ9KbbJd9jpBiDDgMeTEpmj9GEM9L8XtBhlYAXY fFx2kZgBeh7SFTLSRpz0RkMk8P80w5z1YwojZyZym6OmpYNtTgjKdXwlXebJ4jwBbnna 69dWT+0IRbVvG+W00oVrzfZl/tgeGQ/s+ibj2kn3dLk+LRYvEAujab8dEv5eefVMsBQk 2fyEV2qq9s+MXwTyMzjbvfcGJ5uCkV/2YqKw1ESmUtny/qSH95m9ZAe6icn5IX7WCym8 1niG62/NLzgLHYPBM3rwGHDzXoJVCsoLY633z143OjS4yG8Qlk4KFrm1YkhVjMsyGY8S 3QEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726185418; x=1726790218; 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=TWgFsEv6ZnvDTK2SzOTRT82/EbmDTMjLadAnVDO4e1w=; b=lZTNs2oQoKLPLUc9tiO5LA5ELvs1pA/dFXXCb1OKBJNvy6qk9cxQONCYLxpRFAx/Ts lkrFltpcy17BDE3CxkAXynoRYmmFM7t0npY3Ij4Hej2Heg6aD69Ypgn/E9ZWlRNhMRKL W5PRrM4UG9E+44bJURNDBJJze5qHgRtDAoCySQDuH0OWRrJnkNpN/HxRSPS0Q9EoyX4b YYxwpv6DCloieD2osYkNtPBxTqo4ytKl6NiVhu4p8Jz3UU2LksE8LE7huGL7/d2g5Pwa xd7Ev2FNiXVVxtH1eiOEIo7tJyHGH3PX5BTN/5HAcJ1kRMJa4zAp0tSpQVCxIzfyPHgZ hGFQ== X-Gm-Message-State: AOJu0Yz0P59tHNeYSkKjQZ3G3lSxv9CAkiu/rpCM9YQRC5pZgNMf3KZn XIxLqB/ADVmLpWfABINvS+lMR8FZeZ8vFrb8d3OhcLdRF/wws0h+CcrICVd1yDamAPbGoAXHChB Q/uQSxkPSWhkjfqkUFWi43nsCQtPeSA== X-Google-Smtp-Source: AGHT+IF812MfEyiZ/TVQG2QSo8KgSr27r7vulcplkgto9SjkJprs9jnFPsFMgaIEjwplDKmbLyA0V54iYqDNYEb++Fo= X-Received: by 2002:a50:e719:0:b0:5c0:9fca:9352 with SMTP id 4fb4d7f45d1cf-5c413e5f38amr2010448a12.36.1726185417906; Thu, 12 Sep 2024 16:56:57 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Wells Oliver Date: Thu, 12 Sep 2024 16:56:21 -0700 Message-ID: Subject: Re: Query plan getting less efficient over time with frequent updates and deletes.. To: Ron Johnson Cc: pgsql-admin Content-Type: multipart/alternative; boundary="000000000000a6a2d10621f4dc49" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000a6a2d10621f4dc49 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Yes, I regularly look at pg_stat_user_tables and in particular last_autovacuum and last_autoanalyze and these are always the current date (or within two days) after our nightly processes soon finish. I wondered if the similar low planning time but the dissimilar longer execution time might indicate rows are spread out over disk, thereby negating a bitmap heap scan and the slower query taking longer due to having to read a lot more disk? Is that a possibility? On Thu, Sep 12, 2024 at 4:47=E2=80=AFPM Ron Johnson wrote: > On Thu, Sep 12, 2024 at 6:52=E2=80=AFPM Wells Oliver > wrote: > >> Hi all: we have a table which receives frequent daily updates and delete= s >> on the order of 100-600k. The overall row length is approximately 80m. T= his >> table has 50 indexes and 303 columns and is quite frequently queried by >> humans and applications. >> >> I've been in the habit of using pg_repack maybe once a month on this >> table because I can't quite figure out why querying gets bogged down. Th= e >> vacuum and analyze thresholds are set such that the table is both auto >> vacuumed and analyzed every night. >> > > 1. You're absolutely positive that the VACUUM and ANALYZE complete every > night? > 2. Nightly may not be often enough. > > --=20 Wells Oliver wells.oliver@gmail.com --000000000000a6a2d10621f4dc49 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Yes= , I regularly look at pg_stat_user_tables and in particular last_autovacuum= and last_autoanalyze and these are always=C2=A0the current date (or within= two days) after our nightly processes soon finish.

I wondered if the similar low planning time but = the dissimilar longer execution time might indicate rows are spread out ove= r disk, thereby negating a bitmap heap scan and the slower query taking lon= ger due to having to read a lot more disk? Is that a possibility?



On Thu, Sep 12, 2024 at = 4:47=E2=80=AFPM Ron Johnson <= ronljohnsonjr@gmail.com> wrote:
On Thu, Sep 12, 20= 24 at 6:52=E2=80=AFPM Wells Oliver <wells.oliver@gmail.com> wrote:
Hi all: we have a table which= receives frequent daily updates and deletes on the order of 100-600k. The = overall row length is approximately 80m. This table has 50 indexes and 303 = columns and is quite frequently queried by humans and applications.

I'= ;ve been in the habit of using pg_repack maybe once a month on this table b= ecause I can't quite figure out why querying gets bogged down. The vacu= um and analyze thresholds are set such that the table is both auto vacuumed= and analyzed every night.
=C2=A0
1.= You're absolutely positive that the VACUUM and ANALYZE complete every = night?
2. Nightly may not be often enough.



--
--000000000000a6a2d10621f4dc49--