Re: inserting, index and no index - speed - Mailing list pgsql-general

From zilch@home.se
Subject Re: inserting, index and no index - speed
Date
Msg-id 20010611001109.B29684@loony
Whole thread Raw
In response to Re: inserting, index and no index - speed  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: inserting, index and no index - speed  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
> You might try running the ten thousand inserts as a single transaction
> (do "begin" and "end" around them).

A HUGE difference (also completely took away the ID field (serial) having
only name):

Database vacuumed
pg: Trying 25000 inserts on index_with...
Time taken: 12 seconds

Database vacuumed
pg: Trying 25000 inserts on index_without...
Time taken: 12 seconds <--- MIGHT BE BACUASE OF FSYNC!? (fsyncing also for the previous run)

Database vacuumed
pg: Trying 30000 inserts on index_with...
Time taken: 15 seconds

Database vacuumed
pg: Trying 30000 inserts on index_without...
Time taken: 12 seconds

Database vacuumed
pg: Trying 35000 inserts on index_with...
Time taken: 21 seconds

Database vacuumed
pg: Trying 35000 inserts on index_without...
Time taken: 14 seconds

I can't believe what a difference that made. How can it make it faster by
putting it in a transaction? I thought that would make it slower. Like only
a 100th of the time.

Daniel Akerud

pgsql-general by date:

Previous
From: zilch@home.se
Date:
Subject: Re: inserting, index and no index - speed
Next
From: Tom Lane
Date:
Subject: Re: inserting, index and no index - speed