pgsql: Avoid some other O(N^2) hazards in list manipulation.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Avoid some other O(N^2) hazards in list manipulation.
Date: 2021-11-01 20:24:56
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Avoid some other O(N^2) hazards in list manipulation.

In the same spirit as 6301c3ada, fix some more places where we were
using list_delete_first() in a loop and thereby risking O(N^2)
behavior. It's not clear that the lists manipulated in these spots
can get long enough to be really problematic ... but it's not clear
that they can't, either, and the fixes are simple enough.

As before, back-patch to v13.

Discussion: https://postgr.es/m/[email protected]

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/e477642a1ba8041c94cae2f8bbdb689f05cb0260

Modified Files
--------------
contrib/pg_trgm/trgm_regexp.c | 25 +++++++++++++++++--------
src/backend/executor/nodeAgg.c | 17 +++++------------
src/backend/jit/llvm/llvmjit.c | 10 +++++-----
3 files changed, 27 insertions(+), 25 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Daniel Gustafsson 2021-11-01 21:56:02 pgsql: Replace unicode characters in comments with ascii
Previous Message Alvaro Herrera 2021-11-01 16:08:56 pgsql: Handle XLOG_OVERWRITE_CONTRECORD in DecodeXLogOp