> I submitted the appended bug report two days ago, and I resubmit it
> because I do not see it in the mailing lists yet, and I feel that
> the problem constitutes a significant performance issue.
>
> In short, I see 20.3 gigabytes of data memmove()'ed (needlessly in
> this case, which is almost irrelevant) by the pqReadData function
> in the libpq library while retrieving 13 megabytes from the backend.
> It appears to me that the memmove is moving data from and to the
> same memory locations ~1500 times incrementing the number of bytes
> moved by 8K each time.
>
> I tried skipping the memmove when the conn->inStart == 0
> and found that the output sequence is identical to when it is not
> skipped, as I expected.
So you suggesting the following patch, right? Seems safe enough, and I
can imagine memmove not checking if src and dest are the same.
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
? libpq.so.2.2
Index: fe-misc.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v
retrieving revision 1.48
diff -c -r1.48 fe-misc.c
*** fe-misc.c 2001/03/31 23:13:30 1.48
--- fe-misc.c 2001/05/28 13:46:54
***************
*** 400,407 ****
/* Left-justify any data in the buffer to make room */
if (conn->inStart < conn->inEnd)
{
! memmove(conn->inBuffer, conn->inBuffer + conn->inStart,
! conn->inEnd - conn->inStart);
conn->inEnd -= conn->inStart;
conn->inCursor -= conn->inStart;
conn->inStart = 0;
--- 400,408 ----
/* Left-justify any data in the buffer to make room */
if (conn->inStart < conn->inEnd)
{
! if (conn->inStart != 0)
! memmove(conn->inBuffer, conn->inBuffer + conn->inStart,
! conn->inEnd - conn->inStart);
conn->inEnd -= conn->inStart;
conn->inCursor -= conn->inStart;
conn->inStart = 0;