You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Justin Pryzby reported that some scenarios could cause gatheringof extended statistics to spend many seconds in an un-cancelableqsort() operation. To fix, invent qsort_interruptible(), which isjust like qsort_arg() except that it will also do CHECK_FOR_INTERRUPTSevery so often. This bloats the backend by a couple of kB, whichseems like a good investment. (We considered just enablingCHECK_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 canalways change other call sites as we find problems.Back-patch to v14. Before that we didn't have extended stats onexpressions, so that the problem was less severe. Also, this patchdepends on the sort_template infrastructure introduced in v14.Tom Lane and Justin PryzbyDiscussion:https://postgr.es/m/20220509000108.GQ28830@telsasoft.com