Re: Postgres is using 100% CPU

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, May 31, 2015 at 7:53 PM, Yves Dorfsman <yves@xxxxxxxxx> wrote:

>> That's the thing, even on an old laptop with a slow IDE disk, 273
> individual
>> inserts should not take more than a second.
> 

I think that would depend on settings such as synchronous_commit, commit_delay, or whether 2-phase commit is being used. 

If synchronous commit is enabled and commit_delay was not used (e.g. 0), and you have a client synchronously making individual inserts to the DB (1 transaction each), then surely you have delays due to waiting for each transaction to commit synchronously to WAL on disk? 

I believe yes / 0 are the default settings for synchronous commit and commit_delay. (Interestingly the manual pages do not specify.)


Assuming a 5400RPM laptop drive (which is a typical drive - some laptop drives run < 5000RPM), and assuming you are writing a sequential log to disk (with very short gaps between entries being added, e.g. no seek time, only rotational latency) will mean 5400 transactions per minute, 1 write per rotation. 

That's a maximum 90 transactions per second synchronised to WAL. It would take just over 3 seconds.


Ashik, try altering your postgresql.conf to say 'commit_delay=100' or 'synchronous_commit=off'. Let us know if that fixes the problem. Read up on the options before you change them.

Graeme Bell





-- 
Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance





[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux