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.96) (envelope-from ) id 1wE79U-003gde-0o for pgsql-hackers@arkaria.postgresql.org; Sat, 18 Apr 2026 15:00:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wE79T-00D5oR-06 for pgsql-hackers@arkaria.postgresql.org; Sat, 18 Apr 2026 15:00:07 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wE79S-00D5oJ-1z for pgsql-hackers@lists.postgresql.org; Sat, 18 Apr 2026 15:00:06 +0000 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wE79Q-00000001dVe-1ZtR for pgsql-hackers@lists.postgresql.org; Sat, 18 Apr 2026 15:00:05 +0000 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-48334ee0aeaso15501015e9.1 for ; Sat, 18 Apr 2026 08:00:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1776524403; x=1777129203; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id:from:to :cc:subject:date:message-id:reply-to; bh=w5f4N7y1w4EoOxJz3HH4T71S4TSkFiWc9Ho5c6j/Ud8=; b=gmzxGrWka/w6ssyF8A5F8kiKt9wfFnFj6n9xNSPDyiGwt4cZ3BOueOwFJpyQoTflvm gbciU7Qlv8nLryNPjTu3uUYvoTJCdky5l85VJOAAFun9AknDNOqFy+poiW7dkV5RzFLE fqq/JNSyO1Q3Q3//WJ9Z0yHbuvL6YPCyI+6K1aTh66IDTr5VzkS20JCWq3dZM0LHMjPT gsd1yRIz0d4Q4deXpPp2RFMAOfvE8kwx0qAwkKm4t32wowLUO2cq5UMA+VBZBm3cwrUt AGG0b/TLGXzydY1dg99GcrlyC55fCWBApa2btTKGKzmVaSm3YSmQRi1H1eaz8n7Ys/N5 HuJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776524403; x=1777129203; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=w5f4N7y1w4EoOxJz3HH4T71S4TSkFiWc9Ho5c6j/Ud8=; b=oCXT1vAgRTUWBd6ieBmK/yQcCXNxKcL+Azoa1UY0uUfy5LevPi4XyhsxsWhH1RIsyX YNc28UJObyu//k/qy79Z08NjVe9mkuISpdkQAo1foZueT5xsH9wKud3I2UfGjAUc2Ihc xCUnFspnz0mM5vLkJBokabPNn7Go6aRdCGWUSPlIs7ttjW1GduhVyZzy2DvVCAIQQIVy nu9jsLVuP6pRiGFLpC3z1UJpuJZ6ZX5AraZqmFwiHiO4oQRlE5FRyVwCjrwA6vOVNxoy OSvELw+Mrs9COwDerDWuuAg8t/r+mRQSZrlVRxWdH265hRSlQ+oq74U0Hh1lm+TLoilp +h/A== X-Forwarded-Encrypted: i=1; AFNElJ+HwI9fOc37Qz54PPvpNB2nSOBqfuUeFVR0NZ/ac9cQyob23ASEVpbb4l+1AoclVZLYCf9uN0ipXBfxoGXX@lists.postgresql.org X-Gm-Message-State: AOJu0YyjG+e4t5lIkv6Qu3qFycA5YnX097GvPtmL5wfmmIzrMwAE/gVQ XK9mtOTWsuxNKGWYRSdptlmFAxfJ8BsFs6T6H/uREIn7TSD0u8+QhRdN X-Gm-Gg: AeBDieuoVFyUsj+zhLM7yeIQbx3t77HN/3yvu3cTp6/RVjNyResVXYuz+xdVZiy2woT jLC/3j/Acg6Qpp4HH+AauzsqBm3IxiwZnlZKYtoutkuIUFaZkLntbHYzMG6Okx2BAyaxQvS48tG VhIbiG9hItjIYM7JRFnmgjeFnyJlHh1FBigN5stUTPFiwHKTpOPjqCGcI5B/C4jjEORG5H1batg dM/2iyUbDHJgb9TWGrxUNf/Z2piAZglxqqm/ea2/JS0J0sEyGveOTIjRp9valCN+caPBjZSGtVB SlrYi/kUGy9DCCq4G+/zCWhSw1z1v8xrNcFgx7Qnw453R4s3qNxZXEDzzu0c1ontYrsrLbH0+10 sRSOub7TpLs1kY1mnGQskQVFMF20eiMLMupPLQYVFMM12YaTAZyKrCHvmt7mUYJj2q+9fDwiGAk H18K8JOHo2sVlOA+rVOsuzPkesXOZwEZ4XL3c= X-Received: by 2002:a05:600c:3411:b0:487:1c2:6a56 with SMTP id 5b1f17b1804b1-488fb74529fmr66553115e9.3.1776524402993; Sat, 18 Apr 2026 08:00:02 -0700 (PDT) Received: from [192.168.0.50] ([89.149.68.143]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-488fc1393d3sm200058965e9.11.2026.04.18.08.00.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 18 Apr 2026 08:00:02 -0700 (PDT) Message-ID: <46733d68-aec0-4d09-8120-4c66b87047a4@gmail.com> Date: Sat, 18 Apr 2026 18:00:00 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: eliminate xl_heap_visible to reduce WAL (and eventually set VM on-access) From: Alexander Lakhin To: Melanie Plageman , Andres Freund Cc: Tomas Vondra , David Rowley , Kirill Reshke , Chao Li , Andrey Borodin , Xuneng Zhou , Robert Haas , PostgreSQL Hackers , Heikki Linnakangas References: <2be31f17-5405-4de9-8d73-90ebc322f7d8@vondra.me> <97529f5a-ec10-46b1-ab50-4653126c6889@gmail.com> Content-Language: en-US In-Reply-To: <97529f5a-ec10-46b1-ab50-4653126c6889@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello Melanie and Andres, 03.04.2026 08:00, Alexander Lakhin wrote: > > 31.03.2026 19:19, Melanie Plageman wrote: >> Thanks for the reply! I have committed the patches in this thread and >> marked the CF entry accordingly. > > I've come across an interesting failure produced starting from 378a21618: > ... I've discovered one more behaviour change introduced in 378a21618. I investigated a yesterday's skink failure [1]: # --- /home/bf/bf-build/skink-master/HEAD/pgsql/contrib/btree_gist/expected/enum.out 2025-06-23 20:17:56.295775456 +0200 # +++ /home/bf/bf-build/skink-master/HEAD/pgsql.build/testrun/btree_gist/regress/results/enum.out 2026-04-17 22:35:37.212061309 +0200 # @@ -83,12 +83,10 @@ # #  EXPLAIN (COSTS OFF) #  SELECT count(*) FROM enumtmp WHERE a >= 'g'::rainbow; # -                  QUERY PLAN # ------------------------------------------------ # +                   QUERY PLAN # +------------------------------------------------ #   Aggregate # -   ->  Bitmap Heap Scan on enumtmp # -         Recheck Cond: (a >= 'g'::rainbow) # -         ->  Bitmap Index Scan on enumidx # -               Index Cond: (a >= 'g'::rainbow) # -(5 rows) # +   ->  Index Only Scan using enumidx on enumtmp # +         Index Cond: (a >= 'g'::rainbow) # +(3 rows) # # 1 of 32 tests failed. pgsql.build/testrun/btree_gist/regress/log/postmaster.log contains 2026-04-17 22:35:36.909 CEST autovacuum worker[4020330] LOG: automatic analyze of table "regression_btree_gist.public.enumtmp"     avg read rate: 0.000 MB/s, avg write rate: 0.000 MB/s     buffer usage: 128 hits, 0 reads, 0 dirtied     WAL usage: 2 records, 0 full page images, 322 bytes, 0 full page image bytes, 0 buffers full     system usage: CPU: user: 0.05 s, system: 0.00 s, elapsed: 0.11 s and managed to reproduce it locally under Valgrind on a slowed down VM so that the enum test takes ~10 sec: With +select c.relname,c.relpages,c.reltuples,s.autovacuum_count,s.autoanalyze_count +from pg_class c +left join pg_stat_all_tables s on c.oid = s.relid +where c.relname in ('enumtmp', 'enumidx'); added to the test for diagnostics and the test repeated 100 times, I got: ... ok 46        - enum                                    10635 ms ok 47        - enum                                    10559 ms # diff -U3 /home/vagrant/postgres/contrib/btree_gist/expected/enum.out /home/vagrant/postgres/contrib/btree_gist/results/enum.out # --- /home/vagrant/postgres/contrib/btree_gist/expected/enum.out 2026-04-18 11:41:17.224063241 +0000 # +++ /home/vagrant/postgres/contrib/btree_gist/results/enum.out 2026-04-18 11:52:43.870049782 +0000 # @@ -91,18 +91,16 @@ #  where c.relname in ('enumtmp', 'enumidx'); #   relname | relpages | reltuples | autovacuum_count | autoanalyze_count # ---------+----------+-----------+------------------+------------------- # - enumtmp |        3 |       595 |                0 |                 0 # + enumtmp |        3 |       595 |                0 |                 1 #   enumidx |        4 |       595 | | #  (2 rows) # #  EXPLAIN (COSTS OFF) #  SELECT count(*) FROM enumtmp WHERE a >= 'g'::rainbow; # -                  QUERY PLAN # ------------------------------------------------ # +                   QUERY PLAN # +------------------------------------------------ #   Aggregate # -   ->  Bitmap Heap Scan on enumtmp # -         Recheck Cond: (a >= 'g'::rainbow) # -         ->  Bitmap Index Scan on enumidx # -               Index Cond: (a >= 'g'::rainbow) # -(5 rows) # +   ->  Index Only Scan using enumidx on enumtmp # +         Index Cond: (a >= 'g'::rainbow) # +(3 rows) # not ok 48    - enum                                    10596 ms ok 49        - enum                                    11693 ms ok 50        - enum                                    11098 ms ... # 6 of 131 tests failed. I could also reproduce the same diff with just: --- a/contrib/btree_gist/sql/enum.sql +++ b/contrib/btree_gist/sql/enum.sql @@ -40,2 +40,3 @@ SELECT count(*) FROM enumtmp WHERE a > 'g'::rainbow; +ANALYZE enumtmp;  EXPLAIN (COSTS OFF) It's not reproduced at 378a21618~1, though. Could you please look if this can be fixed? [1] https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=skink&dt=2026-04-17%2019%3A10%3A50 Best regards, Alexander