postgresql/src/backend
Bruce Momjian 109f079be6 I made the patch that improved the performance of replace_text().
The content of the patch is as follows:

(1)Create shortcut when subtext was not found.

(2)Stop using LEFT and RIGHT macro.
In LEFT and RIGHT macro, TEXTPOS is executed by the same content as
execution immediately before. The execution frequency of TEXTPOS can be
reduced by using text_substring instead of LEFT and RIGHT macro.

(3)Add appendStringInfoText, and use it instead of
appendStringInfoString.
There is an overhead of PG_TEXT_GET_STR when appendStringInfoString is
executed by text type. This can be reduced by appendStringInfoText.

(4)Reduce execution of TEXTDUP.

The effect of the patch that I measured is as follows:

- The Data for test was created by 'pgbench -i'.

- Test SQL:
 select replace(aid, '9', 'A') from accounts;

- Test results: Linux(CPU: Pentium III, Compiler option: -O2)
 original: 1.515s
 patched:  1.250s

Atsushi Ogawa
2005-07-04 18:56:44 +00:00
..
access Arrange for the postmaster (and standalone backends, initdb, etc) to 2005-07-04 04:51:52 +00:00
bootstrap Arrange for the postmaster (and standalone backends, initdb, etc) to 2005-07-04 04:51:52 +00:00
catalog Arrange for the postmaster (and standalone backends, initdb, etc) to 2005-07-04 04:51:52 +00:00
commands Arrange for the postmaster (and standalone backends, initdb, etc) to 2005-07-04 04:51:52 +00:00
executor Replace pg_shadow and pg_group by new role-capable catalogs pg_authid 2005-06-28 05:09:14 +00:00
lib Replace the use of "0" with "NULL" where appropriate in dllist.c, for 2005-01-18 22:59:32 +00:00
libpq Arrange for the postmaster (and standalone backends, initdb, etc) to 2005-07-04 04:51:52 +00:00
main Tag appropriate files for rc3 2004-12-31 22:04:05 +00:00
nodes Teach planner about some cases where a restriction clause can be 2005-07-02 23:00:42 +00:00
optimizer Don't try to constant-fold functions returning RECORD. We were never 2005-07-03 21:14:18 +00:00
parser More cleanup on roles patch. Allow admin option to be inherited through 2005-06-29 20:34:15 +00:00
po Translation updates 2005-01-17 20:27:44 +00:00
port Refactor fork()-related code. We need to do various housekeeping tasks 2005-03-10 07:14:03 +00:00
postmaster Arrange for the postmaster (and standalone backends, initdb, etc) to 2005-07-04 04:51:52 +00:00
regex Add parentheses to macros when args are used in computations. Without 2005-05-25 21:40:43 +00:00
rewrite Replace pg_shadow and pg_group by new role-capable catalogs pg_authid 2005-06-28 05:09:14 +00:00
storage Arrange for the postmaster (and standalone backends, initdb, etc) to 2005-07-04 04:51:52 +00:00
tcop Arrange for the postmaster (and standalone backends, initdb, etc) to 2005-07-04 04:51:52 +00:00
utils I made the patch that improved the performance of replace_text(). 2005-07-04 18:56:44 +00:00
Makefile On Windows, set the postmaster executable's stack size to 4MB, so that 2005-01-26 21:55:26 +00:00
nls.mk New translation 2005-01-09 17:10:29 +00:00