Re: A little COPY speedup - Mailing list pgsql-patches

From Heikki Linnakangas
Subject Re: A little COPY speedup
Date
Msg-id 45E7F7D1.6040106@enterprisedb.com
Whole thread Raw
In response to Re: A little COPY speedup  ("Simon Riggs" <simon@2ndquadrant.com>)
Responses Re: A little COPY speedup  ("Simon Riggs" <simon@2ndquadrant.com>)
List pgsql-patches
Simon Riggs wrote:
> On Thu, 2007-03-01 at 17:01 +0000, Heikki Linnakangas wrote:
>
>> I ran oprofile on a COPY FROM to get an overview of where the CPU time
>> is spent. To my amazement, the function at the top of the list was
>> PageAddItem with 16% of samples.
>
> Excellent.
>
> I'm slightly worried though since that seems to have changed from 8.2,
> which I oprofiled over Christmas. I can't recall what's changed though.
> Was this just on one system? Is it possible there is an effect on one
> system and not another?

Well, there's one big change: your patch to suppress WAL logging on
tables created in the same transaction. I ran the test again, this time
creating the table in a separate transaction:

samples  %        image name               app name
symbol name
5480     17.0366  postgres                 postgres
XLogInsert
3684     11.4531  postgres                 postgres
PageAddItem
3580     11.1298  libc-2.3.6.so            postgres                 memcpy
2498      7.7660  postgres                 postgres                 DoCopy
1265      3.9327  postgres                 postgres
LWLockAcquire
1210      3.7617  postgres                 postgres
CopyReadLine
1042      3.2394  postgres                 postgres
LWLockRelease
1038      3.2270  postgres                 postgres
heap_formtuple
1033      3.2115  libc-2.3.6.so            postgres
____strtol_l_internal
875       2.7203  postgres                 postgres                 hash_any

The profile will probably look somewhat different depending on your
data, encoding etc.

All the page locking related functions account for ~10% in total,
including the LWLockAcquire/Release, Pin/UnBuffer, hash_any and so on.
And then there's all the memcpying...

--
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com

pgsql-patches by date:

Previous
From: "Simon Riggs"
Date:
Subject: Re: A little COPY speedup
Next
From: "Simon Riggs"
Date:
Subject: Re: A little COPY speedup