diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2022-07-12 16:30:36 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2022-07-12 16:30:36 -0400 |
commit | 12c99c88442d18e82daf521907a6e3d9003295ee (patch) | |
tree | 7ace2a820be382d4ededae582ed0cd9586d44d11 /src/backend/executor/execParallel.c | |
parent | d8759a40bfce756f655b2afab129915640bebf0a (diff) | |
download | postgresql-12c99c88442d18e82daf521907a6e3d9003295ee.tar.gz postgresql-12c99c88442d18e82daf521907a6e3d9003295ee.zip |
Invent qsort_interruptible().
Justin Pryzby reported that some scenarios could cause gathering
of extended statistics to spend many seconds in an un-cancelable
qsort() operation. To fix, invent qsort_interruptible(), which is
just like qsort_arg() except that it will also do CHECK_FOR_INTERRUPTS
every so often. This bloats the backend by a couple of kB, which
seems like a good investment. (We considered just enabling
CHECK_FOR_INTERRUPTS in the existing qsort and qsort_arg functions,
but there are some callers for which that'd demonstrably be unsafe.
Opt-in seems like a better way.)
For now, just apply qsort_interruptible() in statistics collection.
There's probably more places where it could be useful, but we can
always change other call sites as we find problems.
Back-patch to v14. Before that we didn't have extended stats on
expressions, so that the problem was less severe. Also, this patch
depends on the sort_template infrastructure introduced in v14.
Tom Lane and Justin Pryzby
Discussion: https://postgr.es/m/20220509000108.GQ28830@telsasoft.com
Diffstat (limited to 'src/backend/executor/execParallel.c')
0 files changed, 0 insertions, 0 deletions