Обсуждение: INSERT performance tuning experiences

Поиск
Список
Период
Сортировка

INSERT performance tuning experiences

От
Robert Burgholzer
Дата:
Just thought I would relate this, since it is tangible evidence of what is reported in the manuals under WAL tweaking - hope someone finds it useful.

My performance was 76 seconds before tuning versus 7 seconds after tuning.

TASK: Create and populate a table with 30 columns, adding 8,000 rows METHOD: Only INSERT statements (accessed via php which does not allow COPY statements)
SYSTEM: Using an 8.3 install (I know, I know)
WAL CONFIG: changed the default setting of "synchronous_commit = off" to "synchronous_commit = on"
 

--
--
Robert W. Burgholzer
 'Making the simple complicated is commonplace; making the complicated simple, awesomely simple, that's creativity.'  - Charles Mingus

Re: INSERT performance tuning experiences

От
Simon Riggs
Дата:
On 21 November 2013 15:27, Robert Burgholzer <rburghol@vt.edu> wrote:
> Just thought I would relate this, since it is tangible evidence of what is
> reported in the manuals under WAL tweaking - hope someone finds it useful.
>
> My performance was 76 seconds before tuning versus 7 seconds after tuning.
>
> TASK: Create and populate a table with 30 columns, adding 8,000 rows METHOD:
> Only INSERT statements (accessed via php which does not allow COPY
> statements)
> SYSTEM: Using an 8.3 install (I know, I know)
> WAL CONFIG: changed the default setting of "synchronous_commit = off" to
> "synchronous_commit = on"

Good, that is exactly the numbers I would expect and precisely the
reason we added that feature.

You might find a couple of good features in later releases also...

--
 Simon Riggs                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


Re: INSERT performance tuning experiences

От
Robert Burgholzer
Дата:
Thanks for the response Simon.  This is a perfect application of that function, I have a distributed environmental modeling system that generates Gigs and Gigs of time series data, most of which is "write-once read-seldom", and thus not worth the overhead of perpetual storage in the database, or stored in a remote modeling node (also not worth network or storage traffic for synching nodes).  Similarly, since the tables all come from text files, there is virtually no penalty to accepting the risk of pg failure during table loading.

Thanks again,
/r/b

Re: INSERT performance tuning experiences

От
Strahinja Kustudić
Дата:
So you got better insert performance by turning on synchronous_commit? How is that possible? Shouldn't synchronous_commit=off increase performance? Is this only the case with 8.3?

I tried inserting 10k rows in a table with more than 50 columns with and without synchronous_commit and the results were (Postgres 9.1):

off: 1.989s
on: 2.928s

So off is 2 times faster.

Regards,
Strahinja

On Thu, Nov 21, 2013 at 5:03 PM, Robert Burgholzer <rburghol@vt.edu> wrote:
Thanks for the response Simon.  This is a perfect application of that function, I have a distributed environmental modeling system that generates Gigs and Gigs of time series data, most of which is "write-once read-seldom", and thus not worth the overhead of perpetual storage in the database, or stored in a remote modeling node (also not worth network or storage traffic for synching nodes).  Similarly, since the tables all come from text files, there is virtually no penalty to accepting the risk of pg failure during table loading.

Thanks again,
/r/b

Re: INSERT performance tuning experiences

От
Robert Burgholzer
Дата:
Sorry man, I miswrote - the default is ON, and I switched that to OFF - which yielded the performance improvements.. as you would expect. Simon must have just known what I meant when I said I changed the default.

/r/b


On Fri, Nov 22, 2013 at 3:28 PM, Strahinja Kustudić <strahinjak@nordeus.com> wrote:
So you got better insert performance by turning on synchronous_commit? How is that possible? Shouldn't synchronous_commit=off increase performance? Is this only the case with 8.3?

I tried inserting 10k rows in a table with more than 50 columns with and without synchronous_commit and the results were (Postgres 9.1):

off: 1.989s
on: 2.928s

So off is 2 times faster.

Regards,
Strahinja


On Thu, Nov 21, 2013 at 5:03 PM, Robert Burgholzer <rburghol@vt.edu> wrote:
Thanks for the response Simon.  This is a perfect application of that function, I have a distributed environmental modeling system that generates Gigs and Gigs of time series data, most of which is "write-once read-seldom", and thus not worth the overhead of perpetual storage in the database, or stored in a remote modeling node (also not worth network or storage traffic for synching nodes).  Similarly, since the tables all come from text files, there is virtually no penalty to accepting the risk of pg failure during table loading.

Thanks again,
/r/b




--
--
Robert W. Burgholzer
 'Making the simple complicated is commonplace; making the complicated simple, awesomely simple, that's creativity.'  - Charles Mingus

Re: INSERT performance tuning experiences

От
Robert Burgholzer
Дата:
By the way, my machine clearly sucks compared to yours!  I was pretty stoked to get 8,000 in 7 seconds. :)


On Fri, Nov 22, 2013 at 3:28 PM, Strahinja Kustudić <strahinjak@nordeus.com> wrote:
So you got better insert performance by turning on synchronous_commit? How is that possible? Shouldn't synchronous_commit=off increase performance? Is this only the case with 8.3?

I tried inserting 10k rows in a table with more than 50 columns with and without synchronous_commit and the results were (Postgres 9.1):

off: 1.989s
on: 2.928s

So off is 2 times faster.

Regards,
Strahinja


On Thu, Nov 21, 2013 at 5:03 PM, Robert Burgholzer <rburghol@vt.edu> wrote:
Thanks for the response Simon.  This is a perfect application of that function, I have a distributed environmental modeling system that generates Gigs and Gigs of time series data, most of which is "write-once read-seldom", and thus not worth the overhead of perpetual storage in the database, or stored in a remote modeling node (also not worth network or storage traffic for synching nodes).  Similarly, since the tables all come from text files, there is virtually no penalty to accepting the risk of pg failure during table loading.

Thanks again,
/r/b




--
--
Robert W. Burgholzer
 'Making the simple complicated is commonplace; making the complicated simple, awesomely simple, that's creativity.'  - Charles Mingus

Re: INSERT performance tuning experiences

От
Strahinja Kustudić
Дата:
Then all is good. You stunned me for a bit :)

Regards,
Strahinja


On Fri, Nov 22, 2013 at 10:29 PM, Robert Burgholzer <rburghol@vt.edu> wrote:
Sorry man, I miswrote - the default is ON, and I switched that to OFF - which yielded the performance improvements.. as you would expect. Simon must have just known what I meant when I said I changed the default.

/r/b


On Fri, Nov 22, 2013 at 3:28 PM, Strahinja Kustudić <strahinjak@nordeus.com> wrote:
So you got better insert performance by turning on synchronous_commit? How is that possible? Shouldn't synchronous_commit=off increase performance? Is this only the case with 8.3?

I tried inserting 10k rows in a table with more than 50 columns with and without synchronous_commit and the results were (Postgres 9.1):

off: 1.989s
on: 2.928s

So off is 2 times faster.

Regards,
Strahinja


On Thu, Nov 21, 2013 at 5:03 PM, Robert Burgholzer <rburghol@vt.edu> wrote:
Thanks for the response Simon.  This is a perfect application of that function, I have a distributed environmental modeling system that generates Gigs and Gigs of time series data, most of which is "write-once read-seldom", and thus not worth the overhead of perpetual storage in the database, or stored in a remote modeling node (also not worth network or storage traffic for synching nodes).  Similarly, since the tables all come from text files, there is virtually no penalty to accepting the risk of pg failure during table loading.

Thanks again,
/r/b




--
--
Robert W. Burgholzer
 'Making the simple complicated is commonplace; making the complicated simple, awesomely simple, that's creativity.'  - Charles Mingus

Re: INSERT performance tuning experiences

От
Strahinja Kustudić
Дата:
I was testing it on an SSD :D

Regards,
Strahinja


On Fri, Nov 22, 2013 at 10:31 PM, Robert Burgholzer <rburghol@vt.edu> wrote:
By the way, my machine clearly sucks compared to yours!  I was pretty stoked to get 8,000 in 7 seconds. :)


On Fri, Nov 22, 2013 at 3:28 PM, Strahinja Kustudić <strahinjak@nordeus.com> wrote:
So you got better insert performance by turning on synchronous_commit? How is that possible? Shouldn't synchronous_commit=off increase performance? Is this only the case with 8.3?

I tried inserting 10k rows in a table with more than 50 columns with and without synchronous_commit and the results were (Postgres 9.1):

off: 1.989s
on: 2.928s

So off is 2 times faster.

Regards,
Strahinja


On Thu, Nov 21, 2013 at 5:03 PM, Robert Burgholzer <rburghol@vt.edu> wrote:
Thanks for the response Simon.  This is a perfect application of that function, I have a distributed environmental modeling system that generates Gigs and Gigs of time series data, most of which is "write-once read-seldom", and thus not worth the overhead of perpetual storage in the database, or stored in a remote modeling node (also not worth network or storage traffic for synching nodes).  Similarly, since the tables all come from text files, there is virtually no penalty to accepting the risk of pg failure during table loading.

Thanks again,
/r/b




--
--
Robert W. Burgholzer
 'Making the simple complicated is commonplace; making the complicated simple, awesomely simple, that's creativity.'  - Charles Mingus