Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
9e8193a
Fix typo in stats_import.sql
michaelpq Mar 8, 2026
ccd7aba
Refactor tests for catalog diff comparisons in stats_import.sql
michaelpq Mar 8, 2026
4da2afd
Fix size underestimation of DSA pagemap for odd-sized segments
michaelpq Mar 9, 2026
173aa8c
doc: Document IF NOT EXISTS option for ALTER FOREIGN TABLE ADD COLUMN.
MasaoFujii Mar 9, 2026
2799e29
Move comment back to better place
petere Mar 9, 2026
06d8302
Remove trailing period from errmsg in subscriptioncmds.c.
Mar 9, 2026
ffc226a
Prevent restore of incremental backup from bloating VM fork.
robertmhaas Mar 9, 2026
8300d3a
Consider startup cost as a figure of merit for partial paths.
robertmhaas Mar 9, 2026
91f33a2
Replace get_relation_info_hook with build_simple_rel_hook.
robertmhaas Mar 9, 2026
7c8280e
pg_{dump,restore}: Refactor handling of conflicting options.
nathan-bossart Mar 9, 2026
6307b09
Fix misuse of "volatile" in xml.c
michaelpq Mar 9, 2026
03facc1
Switch to FATAL error for missing checkpoint record without backup_label
michaelpq Mar 10, 2026
0fbfd37
Allow extensions to mark an individual index as disabled.
robertmhaas Mar 10, 2026
8080f44
Rename grammar nonterminal to simplify reuse
petere Mar 10, 2026
59bae23
Remove duplicate initialization in initialize_brin_buildstate().
MasaoFujii Mar 10, 2026
a198c26
pg_dumpall: simplify coding of dropDBs()
alvherre Mar 10, 2026
f4a4ce5
heapam: Don't mimic MarkBufferDirtyHint() in inplace updates
anarazel Mar 10, 2026
a596d27
Fix grammar in short description of effective_wal_level.
MasahikoSawada Mar 10, 2026
ac58465
Introduce the REPACK command
alvherre Mar 10, 2026
c2a23dc
Use the newest to-be-frozen xid as the conflict horizon for freezing
melanieplageman Mar 10, 2026
138592d
Don't clear pendingRecoveryConflicts at end of transaction
hlinnaka Mar 10, 2026
4c7362c
Remove unused PruneState member frz_conflict_horizon
melanieplageman Mar 10, 2026
4c910f3
bloom: Optimize bitmap scan path with streaming read
michaelpq Mar 10, 2026
82467f6
Require share-exclusive lock to set hint bits and to flush
anarazel Mar 10, 2026
d537f59
Sort out table_open vs. relation_open in rewriter
petere Mar 11, 2026
e87cd16
Refactor handling of x86 CPUID instructions
lfittl Mar 11, 2026
73a159a
Check for HAVE__CPUIDEX and HAVE__GET_CPUID_COUNT separately
lfittl Jan 31, 2026
eddd4e0
pg_test_timing: Reduce per-loop overhead
lfittl Feb 25, 2026
9d96fc0
instrumentation: Streamline ticks to nanosecond conversion across pla…
lfittl Jul 26, 2025
0d6e010
instrumentation: Use Time-Stamp Counter (TSC) on x86-64 for faster me…
lfittl Mar 11, 2026
96a7c19
pg_test_timing: Also test RDTSC/RDTSCP timing and report time source
lfittl Feb 12, 2026
6aa00e5
instrumentation: ARM support for fast time measurements
lfittl Mar 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -5341,6 +5341,7 @@ if test x"$pgac_cv_prog_CC_cflags__Werror_vla" = x"yes"; then
fi


# -Wvla is not applicable for C++
# On macOS, complain about usage of symbols newer than the deployment target

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -Werror=unguarded-availability-new, for CFLAGS" >&5
Expand Down Expand Up @@ -5433,7 +5434,6 @@ if test x"$pgac_cv_prog_CXX_cxxflags__Werror_unguarded_availability_new" = x"yes
fi


# -Wvla is not applicable for C++

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -Wendif-labels, for CFLAGS" >&5
$as_echo_n "checking whether ${CC} supports -Wendif-labels, for CFLAGS... " >&6; }
Expand Down Expand Up @@ -17657,7 +17657,8 @@ $as_echo "#define HAVE__CPUID 1" >>confdefs.h
fi
fi

# Check for __get_cpuid_count() and __cpuidex() in a similar fashion.
# Check for __get_cpuid_count() and __cpuidex() separately, since we sometimes
# need __cpuidex() even if __get_cpuid_count() is available.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __get_cpuid_count" >&5
$as_echo_n "checking for __get_cpuid_count... " >&6; }
if ${pgac_cv__get_cpuid_count+:} false; then :
Expand Down Expand Up @@ -17690,21 +17691,25 @@ if test x"$pgac_cv__get_cpuid_count" = x"yes"; then

$as_echo "#define HAVE__GET_CPUID_COUNT 1" >>confdefs.h

else
# __cpuidex()
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __cpuidex" >&5
fi
# __cpuidex()
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __cpuidex" >&5
$as_echo_n "checking for __cpuidex... " >&6; }
if ${pgac_cv__cpuidex+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <intrin.h>
#ifdef _MSC_VER
#include <intrin.h>
#else
#include <cpuid.h>
#endif
int
main ()
{
unsigned int exx[4] = {0, 0, 0, 0};
__cpuidex(exx, 7, 0);
int exx[4] = {0, 0, 0, 0};
__cpuidex(exx, 7, 0);

;
return 0;
Expand All @@ -17720,11 +17725,10 @@ rm -f core conftest.err conftest.$ac_objext \
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv__cpuidex" >&5
$as_echo "$pgac_cv__cpuidex" >&6; }
if test x"$pgac_cv__cpuidex" = x"yes"; then
if test x"$pgac_cv__cpuidex" = x"yes"; then

$as_echo "#define HAVE__CPUIDEX 1" >>confdefs.h

fi
fi

# Check for XSAVE intrinsics
Expand Down
32 changes: 18 additions & 14 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -549,10 +549,10 @@ if test "$GCC" = yes -a "$ICC" = no; then
AC_SUBST(PERMIT_DECLARATION_AFTER_STATEMENT)
# Really don't want VLAs to be used in our dialect of C
PGAC_PROG_CC_CFLAGS_OPT([-Werror=vla])
# -Wvla is not applicable for C++
# On macOS, complain about usage of symbols newer than the deployment target
PGAC_PROG_CC_CFLAGS_OPT([-Werror=unguarded-availability-new])
PGAC_PROG_CXX_CFLAGS_OPT([-Werror=unguarded-availability-new])
# -Wvla is not applicable for C++
PGAC_PROG_CC_CFLAGS_OPT([-Wendif-labels])
PGAC_PROG_CXX_CFLAGS_OPT([-Wendif-labels])
PGAC_PROG_CC_CFLAGS_OPT([-Wmissing-format-attribute])
Expand Down Expand Up @@ -2104,7 +2104,8 @@ else
fi
fi

# Check for __get_cpuid_count() and __cpuidex() in a similar fashion.
# Check for __get_cpuid_count() and __cpuidex() separately, since we sometimes
# need __cpuidex() even if __get_cpuid_count() is available.
AC_CACHE_CHECK([for __get_cpuid_count], [pgac_cv__get_cpuid_count],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <cpuid.h>],
[[unsigned int exx[4] = {0, 0, 0, 0};
Expand All @@ -2114,18 +2115,21 @@ AC_CACHE_CHECK([for __get_cpuid_count], [pgac_cv__get_cpuid_count],
[pgac_cv__get_cpuid_count="no"])])
if test x"$pgac_cv__get_cpuid_count" = x"yes"; then
AC_DEFINE(HAVE__GET_CPUID_COUNT, 1, [Define to 1 if you have __get_cpuid_count.])
else
# __cpuidex()
AC_CACHE_CHECK([for __cpuidex], [pgac_cv__cpuidex],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <intrin.h>],
[[unsigned int exx[4] = {0, 0, 0, 0};
__cpuidex(exx, 7, 0);
]])],
[pgac_cv__cpuidex="yes"],
[pgac_cv__cpuidex="no"])])
if test x"$pgac_cv__cpuidex" = x"yes"; then
AC_DEFINE(HAVE__CPUIDEX, 1, [Define to 1 if you have __cpuidex.])
fi
fi
# __cpuidex()
AC_CACHE_CHECK([for __cpuidex], [pgac_cv__cpuidex],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([#ifdef _MSC_VER
#include <intrin.h>
#else
#include <cpuid.h>
#endif],
[[int exx[4] = {0, 0, 0, 0};
__cpuidex(exx, 7, 0);
]])],
[pgac_cv__cpuidex="yes"],
[pgac_cv__cpuidex="no"])])
if test x"$pgac_cv__cpuidex" = x"yes"; then
AC_DEFINE(HAVE__CPUIDEX, 1, [Define to 1 if you have __cpuidex.])
fi

# Check for XSAVE intrinsics
Expand Down
29 changes: 25 additions & 4 deletions contrib/bloom/blscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "miscadmin.h"
#include "pgstat.h"
#include "storage/bufmgr.h"
#include "storage/read_stream.h"

/*
* Begin scan of bloom index.
Expand Down Expand Up @@ -76,11 +77,13 @@ int64
blgetbitmap(IndexScanDesc scan, TIDBitmap *tbm)
{
int64 ntids = 0;
BlockNumber blkno = BLOOM_HEAD_BLKNO,
BlockNumber blkno,
npages;
int i;
BufferAccessStrategy bas;
BloomScanOpaque so = (BloomScanOpaque) scan->opaque;
BlockRangeReadStreamPrivate p;
ReadStream *stream;

if (so->sign == NULL)
{
Expand Down Expand Up @@ -120,14 +123,29 @@ blgetbitmap(IndexScanDesc scan, TIDBitmap *tbm)
if (scan->instrument)
scan->instrument->nsearches++;

/* Scan all blocks except the metapage using streaming reads */
p.current_blocknum = BLOOM_HEAD_BLKNO;
p.last_exclusive = npages;

/*
* It is safe to use batchmode as block_range_read_stream_cb takes no
* locks.
*/
stream = read_stream_begin_relation(READ_STREAM_FULL |
READ_STREAM_USE_BATCHING,
bas,
scan->indexRelation,
MAIN_FORKNUM,
block_range_read_stream_cb,
&p,
0);

for (blkno = BLOOM_HEAD_BLKNO; blkno < npages; blkno++)
{
Buffer buffer;
Page page;

buffer = ReadBufferExtended(scan->indexRelation, MAIN_FORKNUM,
blkno, RBM_NORMAL, bas);

buffer = read_stream_next_buffer(stream, NULL);
LockBuffer(buffer, BUFFER_LOCK_SHARE);
page = BufferGetPage(buffer);

Expand Down Expand Up @@ -163,6 +181,9 @@ blgetbitmap(IndexScanDesc scan, TIDBitmap *tbm)
UnlockReleaseBuffer(buffer);
CHECK_FOR_INTERRUPTS();
}

Assert(read_stream_next_buffer(stream, NULL) == InvalidBuffer);
read_stream_end(stream);
FreeAccessStrategy(bas);

return ntids;
Expand Down
54 changes: 54 additions & 0 deletions doc/src/sgml/config.sgml
Original file line number Diff line number Diff line change
Expand Up @@ -2533,6 +2533,60 @@ include_dir 'conf.d'
</variablelist>
</sect2>

<sect2 id="runtime-config-resource-time">
<title>Timing</title>

<variablelist>
<varlistentry id="guc-timing-clock-source" xreflabel="timing_clock_source">
<term><varname>timing_clock_source</varname> (<type>enum</type>)
<indexterm>
<primary><varname>timing_clock_source</varname> configuration parameter</primary>
</indexterm>
</term>
<listitem>
<para>
Selects the method for making timing measurements using the OS or specialized CPU
instructions. Possible values are:
<itemizedlist>
<listitem>
<para>
<literal>auto</literal> (automatically chooses TSC clock source for modern CPUs,
otherwise uses the OS system clock)
</para>
</listitem>
<listitem>
<para>
<literal>system</literal> (measures timing using the OS system clock)
</para>
</listitem>
<listitem>
<para>
<literal>tsc</literal> (measures timing using the x86-64 Time-Stamp Counter (TSC)
by directly executing RDTSC/RDTSCP instructions, see below)
</para>
</listitem>
</itemizedlist>
The default is <literal>auto</literal>.
</para>
<para>
If enabled, the TSC clock source will use the RDTSC instruction for the x86-64
Time-Stamp Counter (TSC) to perform certain time measurements, for example during
EXPLAIN ANALYZE. The RDTSC instruction has less overhead than going through the OS
clock source, which for an EXPLAIN ANALYZE statement will show timing closer to the
actual runtime when timing is off. For timings that require higher precision the
RDTSCP instruction is used, which avoids inaccuracies due to CPU instruction re-ordering.
Use of RDTSC/RDTSC is not supported on older CPUs or hypervisors that don't pass the TSC
frequency to guest VMs, and is not advised on systems that utilize an emulated TSC.
</para>
<para>
To help decide which clock source to use on an x86-64 system you can run the
<application>pg_test_timing</application> utility to check TSC availability, and
perform timing measurements.
</para>
</listitem>
</varlistentry>
</variablelist>
</sect2>

<sect2 id="runtime-config-resource-background-writer">
<title>Background Writer</title>
Expand Down
Loading