pg_dump insert with column names speedup - Mailing list pgsql-hackers

From David Rowley
Subject pg_dump insert with column names speedup
Date
Msg-id CAApHDvrORPUhLipG8-cbThnKPSq3QKCH7Osq9yJZsN00+kBRmA@mail.gmail.com
Whole thread Raw
Responses Re: pg_dump insert with column names speedup
List pgsql-hackers
Here's a small patch which greatly increases the speed of pg_dump --column-inserts.

Previous to this patch a string was being build for the names of the columns for each row in the table... I've now changed this to only do this once for the table.

I also did some clean ups to remove calling the va_args function to write to the backup file when it was not needed, it instead now uses the puts type function which should be faster.

Here are some benchmark results on how it performs:

*** patched ***
D:\9.4\bin>timer pg_dump --column-inserts -f d:\postgres_backup.sql postgres
Ran for 5850 ms

D:\9.4\bin>timer pg_dump --column-inserts -f d:\postgres_backup.sql postgres
Ran for 5790 ms

D:\9.4\bin>timer pg_dump --column-inserts -f d:\postgres_backup.sql postgres
Ran for 5700 ms

D:\9.4\bin>timer pg_dump --column-inserts -f d:\postgres_backup.sql postgres
Ran for 5760 ms

D:\9.4\bin>timer pg_dump --column-inserts -f d:\postgres_backup.sql postgres
Ran for 5730 ms

*** unpatched ***

D:\9.4\bin>timer pg_dump --column-inserts -f d:\postgres_backup.sql postgres
Ran for 9580 ms

D:\9.4\bin>timer pg_dump --column-inserts -f d:\postgres_backup.sql postgres
Ran for 9330 ms

D:\9.4\bin>timer pg_dump --column-inserts -f d:\postgres_backup.sql postgres
Ran for 9250 ms

D:\9.4\bin>timer pg_dump --column-inserts -f d:\postgres_backup.sql postgres
Ran for 9230 ms

D:\9.4\bin>timer pg_dump --column-inserts -f d:\postgres_backup.sql postgres
Ran for 9240 ms

The database contained a single 1 million record table with 6 columns.

Regards

David Rowley

Attachment

pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: GSOC13 proposal - extend RETURNING syntax
Next
From: "MauMau"
Date:
Subject: Re: 9.4 HEAD: select() failed in postmaster