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 1maJqN-0006o5-I1 for pgsql-performance@arkaria.postgresql.org; Tue, 12 Oct 2021 15:37:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1maJqK-0005gY-0d for pgsql-performance@arkaria.postgresql.org; Tue, 12 Oct 2021 15:37:28 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1maJqJ-0005gQ-Me for pgsql-performance@lists.postgresql.org; Tue, 12 Oct 2021 15:37:27 +0000 Received: from mail-qk1-x72d.google.com ([2607:f8b0:4864:20::72d]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1maJqH-000442-23 for pgsql-performance@lists.postgresql.org; Tue, 12 Oct 2021 15:37:27 +0000 Received: by mail-qk1-x72d.google.com with SMTP id bl14so6361168qkb.4 for ; Tue, 12 Oct 2021 08:37:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :references:from:in-reply-to; bh=UBoNj58djBezHz3mSLwTbSDKelcdSn1bgBCNcgjOH7c=; b=nBNRcj/04WY1QHx0Nsw4ryH0gMK9UbcDp8DDXbxDLmmeAKUyCfOtwql5Eg2nGThHKf bSv1Xl1aDZTJDCVziNMZ7hnwXaanGr9O6+2DqYLZOJjRT4pn2pfTKeylUSK9ytb+V+8S 7roBL2GR9IACqSJXTPH6ArMTS/Bj1yBnpV8Zy8sfgs3Ev0NYgV3+IIrMrcSq8BG1sar3 R+betZXBW6wwuL+Wi6pTjFfLg7G4345X3rjWk7sEaFooxRB7l5PzUg/hUDgw3cKJ0kUD 4bKGiI1b9AK4+kV+jYaPgd1glzykh/H8mWjUgOjvhSzGy/Vjx0caYhZVKA7sL/9tll6r L05w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to; bh=UBoNj58djBezHz3mSLwTbSDKelcdSn1bgBCNcgjOH7c=; b=8Hv+WFuORZAXiVswe+YehsFnm6kk4lHSbp68ytNmONMaIFDMomXfCfnoFnyVz17B7Z UPq46Tm9tQ9dCj6oPv+a1GJcBj5+ROz9rsP0Imftt9W/m0rbrF9gukK5X89gNJk0qaRa ggS3YSZ78xjvT+ah+a5gTH7DxHclJ5Ds72cY37YQikIGd3xfxZbkIzioYSRtuJEL9IH8 PtCpTdOTSYBa8R+cV9+gArj557XB6ZKq0BPD/jinugdWM1rwHSQUg5J5QDlwTIDgl/W8 M1PcJOnxFAg2wO+dKUhYc9l1eNsYdXtNEqInSHpiSSOohkEX3pGeBuZ0880sLLEF/qZG a6hA== X-Gm-Message-State: AOAM5334BUXeqSO9FkA7rTY6KolRr7Fc00Oat9WDMhlxN2bL0r7waBjH fDgztu93LkwHDZUhufnlvHhyiZ5kUNytVw== X-Google-Smtp-Source: ABdhPJwv57pFCXUmD59FZ1gR8VoEAProH3iFxs/c/1pwjf9nQdArJxAHn3MV46SPUqUmCi2ee5Novw== X-Received: by 2002:a37:9144:: with SMTP id t65mr20549203qkd.170.1634053041624; Tue, 12 Oct 2021 08:37:21 -0700 (PDT) Received: from [192.168.2.100] (pool-72-79-19-93.nwrknj.east.verizon.net. [72.79.19.93]) by smtp.gmail.com with ESMTPSA id b3sm117998qkj.76.2021.10.12.08.37.21 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 12 Oct 2021 08:37:21 -0700 (PDT) Content-Type: multipart/alternative; boundary="------------vSFVQwaHeVFmmRWNdAgDNwQF" Message-ID: <938bdd7b-9a0d-1675-2c6c-ed1420f42b32@gmail.com> Date: Tue, 12 Oct 2021 11:37:20 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.0 Subject: Re: Lock contention high Content-Language: en-US To: pgsql-performance@lists.postgresql.org References: From: Mladen Gogala In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------vSFVQwaHeVFmmRWNdAgDNwQF Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 10/12/21 03:35, Ashkil Dighin wrote: > 1.Is there a way to tune the lock contention ? Lock contention is usually an application issue. Application processes are stepping on each other's toes. I have never seen a situation where the database would be slow with managing locks. Postgres uses an in-memory queue manager which is, generally speaking, very fast. Applications usually do stupid things. I've seen GUI doing "SELECT FOR UPDATE". And then the operator decided to have lunch. I'll leave the rest to your imagination. -- Mladen Gogala Database Consultant Tel: (347) 321-1217 https://dbwhisperer.wordpress.com --------------vSFVQwaHeVFmmRWNdAgDNwQF Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit


On 10/12/21 03:35, Ashkil Dighin wrote:
1.Is there a way to tune the lock contention ?

Lock contention is usually an application issue. Application processes are stepping on each other's toes. I have never seen a situation where the database would be slow with managing locks. Postgres uses an in-memory queue manager which is, generally speaking, very fast. Applications usually do stupid things. I've seen GUI doing "SELECT FOR UPDATE". And then the operator decided to have lunch. I'll leave the rest to your imagination.


-- 
Mladen Gogala
Database Consultant
Tel: (347) 321-1217
https://dbwhisperer.wordpress.com
--------------vSFVQwaHeVFmmRWNdAgDNwQF--