pgsql: Adjust tuples estimate for appendrels

2025-02-16 Thread Richard Guo
Adjust tuples estimate for appendrels In set_append_rel_size(), we currently set rel->tuples to rel->rows for an appendrel. Generally, rel->tuples is the raw number of tuples in the relation and rel->rows is the estimated number of tuples after the relation's restriction clauses have been applied

pgsql: Get rid of WALBufMappingLock

2025-02-16 Thread Alexander Korotkov
Get rid of WALBufMappingLock Allow multiple backends to initialize WAL buffers concurrently. This way `MemSet((char *) NewPage, 0, XLOG_BLCKSZ);` can run in parallel without taking a single LWLock in exclusive mode. The new algorithm works as follows: * reserve a page for initialization using X

pgsql: Release notes for 17.4, 16.8, 15.12, 14.17, 13.20.

2025-02-16 Thread Tom Lane
Release notes for 17.4, 16.8, 15.12, 14.17, 13.20. Branch -- REL_15_STABLE Details --- https://git.postgresql.org/pg/commitdiff/c479dc817800c074400e0423c77e3d9de35d Modified Files -- doc/src/sgml/release-15.sgml | 89 1 file cha

pgsql: Release notes for 17.4, 16.8, 15.12, 14.17, 13.20.

2025-02-16 Thread Tom Lane
Release notes for 17.4, 16.8, 15.12, 14.17, 13.20. Branch -- REL_14_STABLE Details --- https://git.postgresql.org/pg/commitdiff/10b5dac700c5ade20dc31f3cf2f04c54cbb82ffa Modified Files -- doc/src/sgml/release-14.sgml | 114 +++ 1 file cha

pgsql: Release notes for 17.4, 16.8, 15.12, 14.17, 13.20.

2025-02-16 Thread Tom Lane
Release notes for 17.4, 16.8, 15.12, 14.17, 13.20. Branch -- REL_13_STABLE Details --- https://git.postgresql.org/pg/commitdiff/e8f5b51ae052eb0b73c0eb211999f8c89f59ba43 Modified Files -- doc/src/sgml/release-13.sgml | 120 +++ 1 file cha

pgsql: Release notes for 17.4, 16.8, 15.12, 14.17, 13.20.

2025-02-16 Thread Tom Lane
Release notes for 17.4, 16.8, 15.12, 14.17, 13.20. Branch -- REL_17_STABLE Details --- https://git.postgresql.org/pg/commitdiff/848e2c6abc941267a4b2eb00a57c34ef3165ffb3 Modified Files -- doc/src/sgml/release-17.sgml | 117 +++ 1 file cha

pgsql: Release notes for 17.4, 16.8, 15.12, 14.17, 13.20.

2025-02-16 Thread Tom Lane
Release notes for 17.4, 16.8, 15.12, 14.17, 13.20. Branch -- REL_16_STABLE Details --- https://git.postgresql.org/pg/commitdiff/27e48f004a89a191b24c292e0fb9a8b35d92493c Modified Files -- doc/src/sgml/release-16.sgml | 104 +++ 1 file cha

pgsql: Move wal_buffers_full from PgStat_PendingWalStats to WalUsage

2025-02-16 Thread Michael Paquier
Move wal_buffers_full from PgStat_PendingWalStats to WalUsage wal_buffers_full has been introduced in pg_stat_wal in 8d9a935965f, as some information providing metrics for the tuning of the GUC wal_buffers. WalUsage has been introduced before that in df3b181499. Moving this field is proving to b

pgsql: pg_stat_statements: Add wal_buffers_full

2025-02-16 Thread Michael Paquier
pg_stat_statements: Add wal_buffers_full wal_buffers_full tracks the number of times WAL buffers become full, giving hints to be able to tune the GUC wal_buffers. Up to now, this information was only available in pg_stat_wal. With this field available in WalUsage since eaf502747bac, exposing it

pgsql: Add information about WAL buffers being full to EXPLAIN (WAL)

2025-02-16 Thread Michael Paquier
Add information about WAL buffers being full to EXPLAIN (WAL) This is similar to ce5bcc4a9f26, relying on the addition of wal_buffers_full to WalUsage. This time, the information is added to the output generated by EXPLAIN (WAL). Author: Bertrand Drouvot Reviewed-by: Ilia Evdokimov Discussion:

pgsql: Add information about WAL buffers full to VACUUM/ANALYZE (VERBOS

2025-02-16 Thread Michael Paquier
Add information about WAL buffers full to VACUUM/ANALYZE (VERBOSE) This commit adds the information about the number of times WAL buffers have been full to the logs generated by VACUUM/ANALYZE (VERBOSE) and in the logs generated by autovacuum, complementing the existing information stored by WalUs

pgsql: Fix an oversight in cbc127917 to handle MERGE correctly

2025-02-16 Thread Amit Langote
Fix an oversight in cbc127917 to handle MERGE correctly ExecInitModifyTable() forgot to trim MERGE-related lists to exclude entries for result relations pruned during initial pruning, so fix that. While at it, make the function's use of the pruned resultRelations list, rather than ModifyTable.res

pgsql: In fmtIdEnc(), handle failure of enlargePQExpBuffer().

2025-02-16 Thread Tom Lane
In fmtIdEnc(), handle failure of enlargePQExpBuffer(). Coverity complained that we weren't doing that, and it's right. This fix just makes fmtIdEnc() honor the general convention that OOM causes a PQExpBuffer to become marked "broken", without any immediate error. In the pretty-unlikely case tha

pgsql: In fmtIdEnc(), handle failure of enlargePQExpBuffer().

2025-02-16 Thread Tom Lane
In fmtIdEnc(), handle failure of enlargePQExpBuffer(). Coverity complained that we weren't doing that, and it's right. This fix just makes fmtIdEnc() honor the general convention that OOM causes a PQExpBuffer to become marked "broken", without any immediate error. In the pretty-unlikely case tha

pgsql: In fmtIdEnc(), handle failure of enlargePQExpBuffer().

2025-02-16 Thread Tom Lane
In fmtIdEnc(), handle failure of enlargePQExpBuffer(). Coverity complained that we weren't doing that, and it's right. This fix just makes fmtIdEnc() honor the general convention that OOM causes a PQExpBuffer to become marked "broken", without any immediate error. In the pretty-unlikely case tha

pgsql: In fmtIdEnc(), handle failure of enlargePQExpBuffer().

2025-02-16 Thread Tom Lane
In fmtIdEnc(), handle failure of enlargePQExpBuffer(). Coverity complained that we weren't doing that, and it's right. This fix just makes fmtIdEnc() honor the general convention that OOM causes a PQExpBuffer to become marked "broken", without any immediate error. In the pretty-unlikely case tha

pgsql: In fmtIdEnc(), handle failure of enlargePQExpBuffer().

2025-02-16 Thread Tom Lane
In fmtIdEnc(), handle failure of enlargePQExpBuffer(). Coverity complained that we weren't doing that, and it's right. This fix just makes fmtIdEnc() honor the general convention that OOM causes a PQExpBuffer to become marked "broken", without any immediate error. In the pretty-unlikely case tha

pgsql: In fmtIdEnc(), handle failure of enlargePQExpBuffer().

2025-02-16 Thread Tom Lane
In fmtIdEnc(), handle failure of enlargePQExpBuffer(). Coverity complained that we weren't doing that, and it's right. This fix just makes fmtIdEnc() honor the general convention that OOM causes a PQExpBuffer to become marked "broken", without any immediate error. In the pretty-unlikely case tha