Re: CopyReadAttributesCSV optimization

From: "Heikki Linnakangas" <heikki(at)enterprisedb(dot)com>
To: "Andrew Dunstan" <andrew(at)dunslane(dot)net>
Cc: "pgsql-patches" <pgsql-patches(at)postgresql(dot)org>
Subject: Re: CopyReadAttributesCSV optimization
Date: 2008-03-08 18:17:26
Message-ID: 47D2D836.7080104@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Andrew Dunstan wrote:
>
>
> Heikki Linnakangas wrote:
>> Here's a patch to speed up CopyReadAttributesCSV. On the test case
>> I've been playing with, loading the TPC-H partsupp table, about 20%
>> CopyReadAttributesCSV (inlined into DoCopy, DoCopy itself is
>> insignificant):
>>
>>
> [snip]
>>
>> The trick is to split the loop in CopyReadAttributesCSV into two
>> parts, inside quotes, and outside quotes, saving some instructions in
>> both parts.
>>
>> Your mileage may vary, but I'm quite happy with this. I haven't tested
>> it much yet, but I wouldn't expect it to be a loss in any interesting
>> scenario. The code also doesn't look much worse after the patch,
>> perhaps even better.
>>
>>
>
> This looks sane enough, and worked for me in testing, so I'm going to
> apply it shortly. I'll probably add a comment or two about how the loops
> interact.

Thanks.

FWIW, I did some more performance testing, with input consisting of a
lot of quotes, and it seems the performance gain holds even then. I was
not able to find an input where the new version performs worse.

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

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2008-03-10 01:23:46 Re: Silly bug in pgbench's random number generator
Previous Message Heikki Linnakangas 2008-03-08 09:35:26 Re: CopyReadLineText optimization