Re: 10.2: high cpu usage on update statement

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Kevin Wilkinson <w(dot)kevin(dot)wilkinson(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: 10.2: high cpu usage on update statement
Date: 2019-04-08 06:41:12
Message-ID: d4054043f1ba2bd30f2abbc9492ba4e5a1a0de15.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Kevin Wilkinson wrote:
> on 10.2, we're seeing very high cpu usage when doing an update statement
> on a relatively small table (1GB). one of the updated columns is text,
> about 1k bytes. there are four threads doing similar updates
> concurrently to the same table (but different rows). each thread does an
> update about every two seconds, i.e., the tables gets updated every 1/2
> second. the stack trace below shows the process stuck in reading the
> update results. this seems very odd. has anyone seen something similar?
> this is a modest server of 8 cores, all of which are 90% busy.

Try to profile the server ("perf" on Linux) to see where the time is spent.

Are there any foreign key constraints pointing to the table being updated?
Then make sure that either no key column is updates or that the foreign
keys are indexed.

Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Arup Rakshit 2019-04-08 07:54:47 SQl help to build a result with custom aliased bool column
Previous Message Pavel Stehule 2019-04-08 06:21:54 Re: Unable to Vacuum Large Defragmented Table