postgres/src/test
Peter Geoghegan b3f1a13f22 Avoid extra index searches through preprocessing.
Transform low_compare and high_compare nbtree skip array inequalities
(with opclasses that offer skip support) in such a way as to allow
_bt_first to consistently apply later keys when it descends the tree.
This can lower the number of index searches for multi-column scans that
use a ">" key on one of the index's prefix columns (or use a "<" key,
when scanning backwards) when it precedes some later lower-order key.

For example, an index qual "WHERE a > 5 AND b = 2" will now be converted
to "WHERE a >= 6 AND b = 2" by a new preprocessing step that takes place
after low_compare and high_compare have been finalized.  That way, the
initial call to _bt_first can use "WHERE a >= 6 AND b = 2" to find an
initial position, rather than just using "WHERE a > 5" -- "b = 2" can be
applied during every _bt_first call.  There's a decent chance that this
will allow such a scan to avoid the extra search that might otherwise be
needed to determine the lowest "a" value still satisfying "WHERE a > 5".

The transformation process can only lower the total number of index
pages read when the use of a more restrictive set of initial positioning
keys in _bt_first actually allows the scan to land on some later leaf
page directly, relative to the unoptimized case (or on an earlier leaf
page directly, when scanning backwards).  But the savings can really add
up in cases where an affected skip array comes after some other array.
For example, a scan indexqual "WHERE x IN (1, 2, 3) AND y > 5 AND z = 2"
can save as many as 3 _bt_first calls by applying the new transformation
to its "y" array (up to 1 extra search can be avoided per "x" element).

Follow-up to commit 92fe23d9, which added nbtree skip scan.

Author: Peter Geoghegan <pg@bowt.ie>
Reviewed-By: Matthias van de Meent <boekewurm+postgres@gmail.com>
Discussion: https://postgr.es/m/CAH2-Wz=FJ78K3WsF3iWNxWnUCY9f=Jdg3QPxaXE=uYUbmuRz5Q@mail.gmail.com
2025-04-04 14:14:08 -04:00
..
authentication Fix typo 2025-03-24 17:36:44 +01:00
examples libpq: Deprecate pg_int64. 2025-03-25 21:40:00 +13:00
icu Update copyright for 2025 2025-01-01 11:21:55 -05:00
isolation Add test for HeapBitmapScan's broken skip_fetch optimization 2025-04-02 14:58:39 -04:00
kerberos Update copyright for 2025 2025-01-01 11:21:55 -05:00
ldap Update copyright for 2025 2025-01-01 11:21:55 -05:00
locale Update copyright for 2025 2025-01-01 11:21:55 -05:00
mb
modules oauth: Remove timeout from t/002_client when not needed 2025-04-03 20:41:09 +02:00
perl Verify roundtrip dump/restore of regression database 2025-04-01 18:50:40 +02:00
postmaster Fix inconsistent quoting for some options in TAP tests 2025-03-17 14:07:12 +09:00
recovery Fix logical decoding test to correctly check slot removal on standby. 2025-04-04 13:32:46 +09:00
regress Avoid extra index searches through preprocessing. 2025-04-04 14:14:08 -04:00
ssl libpq: Add support for dumping SSL key material to file 2025-04-03 13:16:43 +02:00
subscription Stablize tests added in 3abe9dc188. 2025-03-28 11:03:05 +05:30
Makefile Add PG_TEST_EXTRA configure option to the Make builds 2024-11-04 14:09:38 +02:00
meson.build Update copyright for 2025 2025-01-01 11:21:55 -05:00
README

PostgreSQL tests
================

This directory contains a variety of test infrastructure as well as some of the
tests in PostgreSQL. Not all tests are here -- in particular, there are more in
individual contrib/ modules and in src/bin.

Not all these tests get run by "make check". Check src/test/Makefile to see
which tests get run automatically.

authentication/
  Tests for authentication (but see also below)

examples/
  Demonstration programs for libpq that double as regression tests via
  "make check"

isolation/
  Tests for concurrent behavior at the SQL level

kerberos/
  Tests for Kerberos/GSSAPI authentication and encryption

ldap/
  Tests for LDAP-based authentication

locale/
  Sanity checks for locale data, encodings, etc

mb/
  Tests for multibyte encoding (UTF-8) support

modules/
  Extensions used only or mainly for test purposes, generally not suitable
  for installing in production databases

perl/
  Infrastructure for Perl-based TAP tests

recovery/
  Test suite for recovery and replication

regress/
  PostgreSQL's main regression test suite, pg_regress

ssl/
  Tests to exercise and verify SSL certificate handling

subscription/
  Tests for logical replication