pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Avoid some other O(N^2) hazards in list manipulation.
Date: Mon, 01 Nov 2021 20:24:56 +0000
Message-ID: <E1mhdrU-0001fE-8A@gemulon.postgresql.org> (raw)

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/CD2F0E7F-9822-45EC-A411-AE56F14DEA9F@amazon.com

Branch
------
master

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

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(-)



view thread (3+ messages)  latest in thread

Message-ID: <E1mhdrU-0001fE-8A@gemulon.postgresql.org>
Permalink:  ../E1mhdrU-0001fE-8A@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1mhdrU-0001fE-8A@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Avoid some other O(N^2) hazards in list manipulation.
  In-Reply-To: <E1mhdrU-0001fE-8A@gemulon.postgresql.org>
  References: <E1mhdrU-0001fE-8A@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox