Skip site navigation (1) Skip section navigation (2)

pgsql: Fix performance issues in replace_text(), replace_text_regexp(),

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix performance issues in replace_text(), replace_text_regexp(),
Date: 2006-11-08 19:22:25
Message-ID: 20061108192225.371439FB26B@postgresql.org (view raw or flat)
Thread:
Lists: pgsql-committers
Log Message:
-----------
Fix performance issues in replace_text(), replace_text_regexp(), and
text_to_array(): they all had O(N^2) behavior on long input strings in
multibyte encodings, because of repeated rescanning of the input text to
identify substrings whose positions/lengths were computed in characters
instead of bytes.  Fix by tracking the current source position as a char
pointer as well as a character-count.  Also avoid some unnecessary palloc
operations.  text_to_array() also leaked memory intracall due to failure
to pfree temporary strings.  Per gripe from Tatsuo Ishii.

Modified Files:
--------------
    pgsql/src/backend/utils/adt:
        varlena.c (r1.152 -> r1.153)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/varlena.c.diff?r1=1.152&r2=1.153)

pgsql-committers by date

Next:From: Tom LaneDate: 2006-11-08 19:24:38
Subject: pgsql: Tweak accumArrayResult() to double the size of its working arrays
Previous:From: Neil ConwayDate: 2006-11-08 19:06:15
Subject: pgsql: Fix two typos.

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group