From: | tgl(at)postgresql(dot)org (Tom Lane) |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Marginal hacking to improve the speed of COPY OUT. |
Date: | 2007-06-17 23:39:28 |
Message-ID: | 20070617233928.86B5F9FB34D@postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Log Message:
-----------
Marginal hacking to improve the speed of COPY OUT. I had found in a bit of
profiling that CopyAttributeOutText was taking an unreasonable fraction of
the backend run time (like 66%!) on the following trivial test case:
$ time psql -c "copy (select repeat('xyzzy',50) from generate_series(1,10000000)) to stdout" regression >/dev/null
The time is all being spent on scanning the string for characters to be
escaped, which most of the time there aren't any of. Some tweaking to take
as many tests as possible out of the inner loop reduced the runtime of this
example by more than 10%. In a real-world case it wouldn't be as useful
a speedup, but it still seems worth adding a few lines here.
Modified Files:
--------------
pgsql/src/backend/commands:
copy.c (r1.283 -> r1.284)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/copy.c.diff?r1=1.283&r2=1.284)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2007-06-18 00:47:20 | pgsql: Update obsolete comment: it's no longer the case that mdread() |
Previous Message | Tom Lane | 2007-06-17 18:57:29 | pgsql: Revert an ill-considered portion of my patch of 12-Mar, which |