<div dir="ltr"><div class="gmail_extra"><br />On Sun, Aug 31, 2014 at 10:10 AM, Peter Eisentraut <<a
href="mailto:peter_e@gmx.net">peter_e@gmx.net</a>>wrote:<br />><br />> On 8/30/14 2:26 AM, Jeff Janes
wrote:<br/>> > But there cases were people use COPY in a loop with a small amount of<br /> > > data in each
statement.<br/>><br />> What would be the reason for doing that?<br />><br /><br />I used that to the same
thingmany times. In a company that I was employed we developed scripts to migrate data from one database do another.<br
/><br/>The first version we used INSERT statements and was very very slow. Then we wrote a second version changing the
INSERTby COPY statements. The performance was very better, but we believe that could be better, so in the third
versionwe created some kind of "cache" (using arrays) to accumulate the records in memory then after N rows we build
theCOPY statement with the cache contents and run it. This was a really good performance improvement.<br /><br />It's
myuse case to we have a feature to postpone the heap_sync in COPY statements. I don't know if it's a feature that a lot
ofpeople wants, but IMHO it could be nice to improve the bulk load operations.<br /><br />Regards,<br /><br />--<br
/>Fabríziode Royes Mello<br />Consultoria/Coaching PostgreSQL<br />>> Timbira: <a
href="http://www.timbira.com.br">http://www.timbira.com.br</a><br/>>> Blog: <a
href="http://fabriziomello.github.io">http://fabriziomello.github.io</a><br/> >> Linkedin: <a
href="http://br.linkedin.com/in/fabriziomello">http://br.linkedin.com/in/fabriziomello</a><br/>>> Twitter: <a
href="http://twitter.com/fabriziomello">http://twitter.com/fabriziomello</a><br/>>> Github: <a
href="http://github.com/fabriziomello">http://github.com/fabriziomello</a></div></div>