pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: sf_postgresql@informationsoftworks.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #17896: xmlagg exponentially slower than string_agg equivalent
Date: Sat, 15 Apr 2023 10:45:42 -0400
Message-ID: <1701648.1681569942@sss.pgh.pa.us> (raw)
In-Reply-To: <17896-f4bf54f99b6a3089@postgresql.org>
References: <17896-f4bf54f99b6a3089@postgresql.org>

PG Bug reporting form <noreply@postgresql.org> writes:
> Also, while string_agg() seems to scale linearly (O(n)), xmlagg() seems to
> scale somewhat steeper (O(n^2)?).

Yeah, string_agg was optimized long ago to avoid repeat data copying,
but xmlagg hasn't been.

It looks like xmlagg doesn't make any direct use of libxml, which suggests
that this wouldn't be terribly hard to fix if somebody were motivated
to try.  The xml type is a bit of a development backwater though ...

			regards, tom lane





view thread (2+ messages)

Message-ID: <1701648.1681569942@sss.pgh.pa.us>
Permalink:  ../1701648.1681569942@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1701648.1681569942@sss.pgh.pa.us

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, sf_postgresql@informationsoftworks.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #17896: xmlagg exponentially slower than string_agg equivalent
  In-Reply-To: <1701648.1681569942@sss.pgh.pa.us>

* 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