Copy faster with sorted data? - Mailing list pgsql-general

From Denis Gasparin
Subject Copy faster with sorted data?
Date
Msg-id 405EF892.2020707@edistar.com
Whole thread Raw
List pgsql-general
Hi to all.

I'm loading 20 millions of integers in a simple table like this:

create table test(
    code integer not null primary key
);

I noticed that the time to load the integers changes if the data is
sorted before giving the copy command.

\copy test from 'codes.txt' took about 15 minutes less when codes.txt
was sorted.

I think the cause of this behaviour is index creation. Could it be?

Thank you,
Denis

pgsql-general by date:

Previous
From: Pierre Didelon
Date:
Subject: Re: unsigned types, binary op. and cast pb
Next
From: "Ed L."
Date:
Subject: Slow query not using index