Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kHTPW-0005Xk-7U for pgsql-performance@arkaria.postgresql.org; Sun, 13 Sep 2020 14:55:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kHTPU-0004vg-Rh for pgsql-performance@arkaria.postgresql.org; Sun, 13 Sep 2020 14:55:20 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kHTPU-0004vY-G7 for pgsql-performance@lists.postgresql.org; Sun, 13 Sep 2020 14:55:20 +0000 Received: from mail-qt1-x841.google.com ([2607:f8b0:4864:20::841]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kHTPR-0002yl-0E for pgsql-performance@lists.postgresql.org; Sun, 13 Sep 2020 14:55:19 +0000 Received: by mail-qt1-x841.google.com with SMTP id t20so11584041qtr.8 for ; Sun, 13 Sep 2020 07:55:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=tAQ1TvAkJTy+gqCK+1A+t+t5Vo3KUfwmXgNziyFljOw=; b=lfw5rGSbi/i2RN+dtP9T0VI+7NdD5Cds2vLtbM4M92iAc0FQmd6TWpusGFQzGRWcKf Uzn9zZKhGhYNH6C/gqolRgefUX5Ydf9qDPqd+8HHNwwYXtcTyJv72ySp1rV7fszVKEGV uK3x1YBcSZ0Xrh2fJlSYxk5yR9FBjt9b+Q80w70z6tgoLrjlcTEKILTyDuc8EEH1mOFR rp/juqzfnsLUG4njR4Zk9quxjMj2K3ZsBe9R3T8rxeV3E07uPzWOPGVizkF0/3BZQSgq qTRggJcis0S5lWUviVtPN73qKqkQduZr9FIOGgB4VXjThyoxw0muVzX5uPItUk5BrlDG Z9LA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=tAQ1TvAkJTy+gqCK+1A+t+t5Vo3KUfwmXgNziyFljOw=; b=B6Hv1dmOyczwMdnVyGTi5MSaOeH0TFJZ9SkCTo49f6/SMG64evLpWCpuD8F5YjiOlY ugrYQ800rvit1FroEXnfnO0J61c27nb4KTQ36gPWC3+mqihUt3SsHt+mw2kTaZgHCLm/ fLeI+OPxEyA+pgFtXDQuJ/UHGWOXWf8uXSxBPGfMFizLaqYK5wUGsAb7i0OG3WYYTlcG sg6hu1iPHqZEGN08E8svQjd+37bWLtlpBaAzHq0RxQnax1D+qw+wVLaqzt4o+fUjLq5L Gf/7fwaBlIuPf6vPo/GWZbJtDHk3q3mFc4lS1krJwuvW4Ed16WTXcujcA2ISrje7E+15 OUtA== X-Gm-Message-State: AOAM530wudSiwBMqiuDf2Hj9koWrYPSUv7HbxERWVrmJDoNRrAKTb7nj ZwzQCbkA+BsU1VD7yXQTuW0Ukw== X-Google-Smtp-Source: ABdhPJwh6sPtsqlZgF2aGurYTneeFoda7m506X2MvdFZm0sOtjrMPz7z39ZqFIYaKn/moQQ/GqT78Q== X-Received: by 2002:ac8:4e49:: with SMTP id e9mr9983085qtw.167.1600008915763; Sun, 13 Sep 2020 07:55:15 -0700 (PDT) Received: from perhan.alvh.no-ip.org ([190.95.19.47]) by smtp.gmail.com with ESMTPSA id u15sm11602420qtj.3.2020.09.13.07.55.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Sep 2020 07:55:15 -0700 (PDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 056552A0FF1; Sun, 13 Sep 2020 11:55:13 -0300 (-03) Date: Sun, 13 Sep 2020 11:55:12 -0300 From: Alvaro Herrera To: David Rowley Cc: Raj , Pgsql Performance Subject: Re: CPU hogged by concurrent SELECT..FOR UPDATE SKIP LOCKED Message-ID: <20200913145512.GA22876@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020-Sep-14, David Rowley wrote: > On Tue, 8 Sep 2020 at 06:05, Raj wrote: > > > > > This would not exactly look like a bug, because the message says "to > > > be locked", so at least it's not allowing two workers to lock the same > > > tuple. But it seems that the skip-locked mode should not make an error > > > out of this, but treat it as the tuple was already locked. Why would > > > it want to lock the tuple (representing the job) if another worker has > > > already finished his UPDATE of the job to mark it as "done" (which is > > > what makes the tuple move to the "completed" partition.) > > (It's not very clear who wrote the above text since the quote does not > mention who the author is and the original email didn't appear to have > made it to the list) Same person. https://postgr.es/m/4f379a07-c49b-14dd-ddba-e0aaf37235d5@pragmaticdata.com -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services