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 1tL2Dk-00CIm4-Nn for pgsql-performance@arkaria.postgresql.org; Tue, 10 Dec 2024 15:32:20 +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 1tL2Di-006Fh4-7b for pgsql-performance@arkaria.postgresql.org; Tue, 10 Dec 2024 15:32:19 +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 1tL2Dh-006Fgw-TB for pgsql-performance@lists.postgresql.org; Tue, 10 Dec 2024 15:32:19 +0000 Received: from mail-il1-x135.google.com ([2607:f8b0:4864:20::135]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1tL2Dg-0026CE-9O for pgsql-performance@lists.postgresql.org; Tue, 10 Dec 2024 15:32:18 +0000 Received: by mail-il1-x135.google.com with SMTP id e9e14a558f8ab-3a7d7db4d89so21510465ab.1 for ; Tue, 10 Dec 2024 07:32:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733844734; x=1734449534; 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=T8XVitnKmhHDrYDeUrq0Hv1Gd2c0gWr8OLR21Uy/Yfw=; b=f7FdaLyepVY5HwdANYXUA04FBg+POpKZZHgRrEGI1qD1NOSSPv7VDoB7ovMrPQFdUv D3tak02BpCGe17E3aw43VZb6qIC7hhhrFr7JJ8NS1ymJ02u/vaYz2eMvg3rChNrDvDaP lUSXCJhO9RTnX2GnXp/D+UrJqI4FQ1LEDrAAO26VPdq22rFdb0rh8tGhJ0Bk95IzNtcz 11vJKmmZUoS94nKrvMKR6bt9OpI5+GnfufjqIjjMvSjyk76LjvJBm18mYVX2zhRyWgJV rR8TevNGbMlnrRu0ymaQzqALQNqx2E2ruksdvuk8Uydg0GycMeIUYAKuFWfxRgj1s15m kBig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733844734; x=1734449534; 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=T8XVitnKmhHDrYDeUrq0Hv1Gd2c0gWr8OLR21Uy/Yfw=; b=Jz/pq6ClGAikZI8aYOgsvUHEHgp2rbZyfgG6dt+maFQ6pEXLg7yOR2RK6WMg03KMEI JcV0pp6PKQTQuSmjgGByu8UoY5q2NTwKavs4o1IvjfUvR4E95vsQ0bwKMwd0sr4GjFl6 WCXv44qCbBuPBPHmZB0hR/FQMqMy1d+iz3ZLU5nbfDerFjPUfr970O8eS6yeqhRXsY0R lOI2shevAVvXN8kAVY+GXLnMPT3i+bE3vSIEFdvJs6SOHvxHPY6H4wi+bCOmcwYbQWwc g645aOIWITs9aZLK28hLkUNjbn9EkcnRITdt3jI2IpTAWa64GET1NFWFof/z6X+vxQ1+ L/YQ== X-Forwarded-Encrypted: i=1; AJvYcCU2sH/DkwMpRnXDNhKQUbwAQJnhSfq+m4rfEQxCpUBcDlkSZ8wbf4aof9Z0hahZBJK8iewiQ0HYvGvPoon1na73dA==@lists.postgresql.org X-Gm-Message-State: AOJu0Yw83VQQpSUJw79n3uYK3i+bErDIGo8mz5mcS+KyeeW2CCmp7egU hWjtgc7+W9k0AKHKEpWhUwcnaLZ6K90g3sdajnUJiQlBN4Pr8SzuKU53SRcS+62azGV7L1ZcFI4 tPA12IJgjc+1y6kO52/Lhag5YLHA= X-Gm-Gg: ASbGncsDP0+qy7gmuiKWUJS5fh+eI6cUt8aEToo+L0FMINE4BaImlr85ZF1lu/gjj01 5BGtEXB1b7rRpfvqBa4jBUcE22uDQDqqWm3c= X-Google-Smtp-Source: AGHT+IEseRQZuZ4EHp4hls8tBrmIAsCY3flUzV67J221a/SfCJJ/ULJHY5tGEcWbdRLgPGh+kGJH+9pDgmUzFkjuHP4= X-Received: by 2002:a05:6e02:1c21:b0:3a7:81dd:d0ad with SMTP id e9e14a558f8ab-3a811d90ba0mr163848805ab.7.1733844734568; Tue, 10 Dec 2024 07:32:14 -0800 (PST) MIME-Version: 1.0 References: <5EE4CC0C-E624-4E82-A2E8-B2EBA44D3521@thebuild.com> <3908773.1733760455@sss.pgh.pa.us> In-Reply-To: From: Greg Sabino Mullane Date: Tue, 10 Dec 2024 10:31:37 -0500 Message-ID: Subject: Re: PostgreSQL and a Catch-22 Issue related to dead rows To: Lars Aksel Opsahl Cc: Tom Lane , Christophe Pettus , "pgsql-performance@lists.postgresql.org" Content-Type: multipart/alternative; boundary="0000000000007ff32f0628ec2f18" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000007ff32f0628ec2f18 Content-Type: text/plain; charset="UTF-8" Thanks for that link; seeing actual queries is a big help. One thing to try is to get some index-only scans to run. Regular indexes need to consult the heap (main table) for visibility information, and a bloated table can make that consultation expensive. For example, an index like this should work to trigger an index-only scan: create index gregtest on node(geom) include(node_id) where containing_face=0; For those not following that link, the query is: SELECT node_id, geom FROM node WHERE containing_face IN (0) AND geom && '0102000020A21000000200000025DDA6B95DC62540F4E713991CE84D4017EE7636A3C625404E468D0D23E84D40'::geometry Or if containing_face is not always 0, a more generic variant: create index gregtest on node(geom, containing_face) include (node_id); What is the nature of the updates that are causing that many dead rows in the first place? Cheers, Greg --0000000000007ff32f0628ec2f18 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks for that link; seeing actual queries is a big help.= One thing to try is to get some index-only scans to run. Regular indexes n= eed to consult the heap (main table) for visibility=C2=A0information, and a= bloated table can make that consultation expensive.

For= example, an index like this should work to trigger an index-only scan:

create index gregtest on node(geom) include(node_id) w= here containing_face=3D0;

For those not following that = link, the query is:

SELECT node_id, geom FROM node WHERE containing_= face IN (0)
AND geom && '0102000020A21000000200000025DDA6B95= DC62540F4E713991CE84D4017EE7636A3C625404E468D0D23E84D40'::geometry
=
Or if containing_face is not always 0, a more ge= neric variant:

create index gregtest on node(geom,= containing_face) include (node_id);

What is the n= ature of the updates that are causing that many dead rows in the first plac= e?

Cheers,
Greg

--0000000000007ff32f0628ec2f18--