Heikki Linnakangas 8af2565248 Introduce a new smgr bulk loading facility.
The new facility makes it easier to optimize bulk loading, as the
logic for buffering, WAL-logging, and syncing the relation only needs
to be implemented once. It's also less error-prone: We have had a
number of bugs in how a relation is fsync'd - or not - at the end of a
bulk loading operation. By centralizing that logic to one place, we
only need to write it correctly once.

The new facility is faster for small relations: Instead of of calling
smgrimmedsync(), we register the fsync to happen at next checkpoint,
which avoids the fsync latency. That can make a big difference if you
are e.g. restoring a schema-only dump with lots of relations.

It is also slightly more efficient with large relations, as the WAL
logging is performed multiple pages at a time. That avoids some WAL
header overhead. The sorted GiST index build did that already, this
moves the buffering to the new facility.

The changes to pageinspect GiST test needs an explanation: Before this
patch, the sorted GiST index build set the LSN on every page to the
special GistBuildLSN value, not the LSN of the WAL record, even though
they were WAL-logged. There was no particular need for it, it just
happened naturally when we wrote out the pages before WAL-logging
them. Now we WAL-log the pages first, like in B-tree build, so the
pages are stamped with the record's real LSN. When the build is not
WAL-logged, we still use GistBuildLSN. To make the test output
predictable, use an unlogged index.

Reviewed-by: Andres Freund
Discussion: https://www.postgresql.org/message-id/30e8f366-58b3-b239-c521-422122dd5150%40iki.fi
2024-02-23 16:10:51 +02:00
..
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-18 09:35:12 +01:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00

The PostgreSQL contrib tree
---------------------------

This subtree contains porting tools, analysis utilities, and plug-in
features that are not part of the core PostgreSQL system, mainly
because they address a limited audience or are too experimental to be
part of the main source tree.  This does not preclude their
usefulness.

User documentation for each module appears in the main SGML
documentation.

When building from the source distribution, these modules are not
built automatically, unless you build the "world" target.  You can
also build and install them all by running "make all" and "make
install" in this directory; or to build and install just one selected
module, do the same in that module's subdirectory.

Some directories supply new user-defined functions, operators, or
types.  To make use of one of these modules, after you have installed
the code you need to register the new SQL objects in the database
system by executing a CREATE EXTENSION command.  In a fresh database,
you can simply do

    CREATE EXTENSION module_name;

See the PostgreSQL documentation for more information about this
procedure.