Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hDNyI-0004Ee-BL for pgsql-general@arkaria.postgresql.org; Mon, 08 Apr 2019 06:41:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hDNyG-0002tF-Rt for pgsql-general@arkaria.postgresql.org; Mon, 08 Apr 2019 06:41:32 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hDNyG-0002oE-Fl for pgsql-general@lists.postgresql.org; Mon, 08 Apr 2019 06:41:32 +0000 Received: from mx2.mailbox.org ([80.241.60.215]) by magus.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hDNyD-00083n-Hg for pgsql-general@postgresql.org; Mon, 08 Apr 2019 06:41:31 +0000 Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:105:465:1:1:0]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mx2.mailbox.org (Postfix) with ESMTPS id CE5B1A138D; Mon, 8 Apr 2019 08:41:27 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter06.heinlein-hosting.de (spamfilter06.heinlein-hosting.de [80.241.56.125]) (amavisd-new, port 10030) with ESMTP id widhIMjYmJFR; Mon, 8 Apr 2019 08:41:14 +0200 (CEST) Message-ID: Subject: Re: 10.2: high cpu usage on update statement From: Laurenz Albe To: Kevin Wilkinson , pgsql-general@postgresql.org Date: Mon, 08 Apr 2019 08:41:12 +0200 In-Reply-To: <214e8730-17b5-16be-afd6-8b6175dd15ab@gmail.com> References: <214e8730-17b5-16be-afd6-8b6175dd15ab@gmail.com> Organization: Cybertec Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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