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 1kl6Hy-00023Z-EI for pgsql-performance@arkaria.postgresql.org; Fri, 04 Dec 2020 08:18:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kl6Hx-00010X-DB for pgsql-performance@arkaria.postgresql.org; Fri, 04 Dec 2020 08:18:01 +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 1kl6Hx-00010J-1p for pgsql-performance@lists.postgresql.org; Fri, 04 Dec 2020 08:18:01 +0000 Received: from mail-io1-xd32.google.com ([2607:f8b0:4864:20::d32]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kl6Hs-000552-U0 for pgsql-performance@lists.postgresql.org; Fri, 04 Dec 2020 08:17:59 +0000 Received: by mail-io1-xd32.google.com with SMTP id n14so4896796iom.10 for ; Fri, 04 Dec 2020 00:17:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=tiqmZg8qQJwC0yVgil/1vEDtEDljbRdKrgX/bdMilMY=; b=MWQyULTHbZ/ujbqnq5qyN0zaGsLBQO4JTlGZGk7PBoPsWwHE+EKVbxKh7V60/Ga5JD qWsdsE0MrdWBOEVd4Y4QKmDWXmS2PA5PW08SnqNBKtQJ79fUW3P9oOHcCGY+mn3slpif rc/M4+8knaTWUaN3CY8AkPQHBson8m42nO2IVJCxER+glN1OqXg4fB/pka75zxjWXb1L KqK1WjK9aeuaWWD/TTG6hLLNgKBrG9BaRdnTjI9zO367gijEueu4PQ4OCD/RFAiTaFJ7 puOM8LWWT0l2NTQKxxT0h2ULw0MGDOscorlLbk7Wur2z+OBXwTr6V+vD4BVKqxNu3Pk+ vUJg== 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:references :mime-version:content-disposition:in-reply-to:user-agent; bh=tiqmZg8qQJwC0yVgil/1vEDtEDljbRdKrgX/bdMilMY=; b=H9TzrDOg8z+9zauPbAF49gkStlXwc6cHXX0dizTt4eYMUswbTCzOVwIHx+8PRvg4M5 1hswwL9oMVBr+y/ApJoWBXM1ZHBhen94rpN2TjE154+e2jiYVIsiwrwvTIxZ2py3UcH7 NidUZbNpU+Bgo8/KmmOfnzUOw+EDkKoIt03lM9s8NF2/E2awC1hkWHkAVn5bYvuww4Si b7jcmLcdcjf2arahONd/tIq+Uhms4WUQrHD10hbHgIjRPVTwxLfa/b5EP8zSo87DHvqk qBYUMAjXiV32PWMD5BHHs/P5qHIqCsrJ51rea83vq++VAvOWvzNlDNqukm0qQdbw/SEg L5NA== X-Gm-Message-State: AOAM530CGSJfQ4+ZuPLyD0Z/83BxFat8nNub7ivHz0i8+xTrrQqztmPP H4QeqndDBp6kghnYshuJV8TCTg== X-Google-Smtp-Source: ABdhPJwjQaJMfececlqFr4cdGnuIUfhbCXkHemUUcS7oQ/6BHnAo3NaeVzLK4qcvx/ssbPtzL86FZw== X-Received: by 2002:a02:5e81:: with SMTP id h123mr4896134jab.36.1607069876088; Fri, 04 Dec 2020 00:17:56 -0800 (PST) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id y3sm1188105ilc.2.2020.12.04.00.17.55 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Dec 2020 00:17:55 -0800 (PST) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 3843C80087C; Fri, 4 Dec 2020 02:17:54 -0600 (CST) Date: Fri, 4 Dec 2020 02:17:54 -0600 From: Justin Pryzby To: aditya desai Cc: pgsql-performance@lists.postgresql.org Subject: Re: Pg_locks and pg_stat_activity Message-ID: <20201204081754.GA7761@telsasoft.com> References: <20201204064822.GZ24052@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Fri, Dec 04, 2020 at 01:31:14PM +0530, aditya desai wrote: > Hi Justin, > Many thanks for your response. Please see my response below. > > What do you mean by API ? If it's a different client, how does it connect ? > Queries are getting called from Web UI built in Microservices spring boot. > It connected to Database with JDBC driver. Developers have handled > connection pooling at the Application side. > > What db driver ? > > Driver is JDBC I suspect JDBC is using parameterized queries (postgres $1, $2, ..) and psql isn't (unless you type "prepare p AS SELECT ..." and execute p(.., .., ..)" You can search and find other people who reported similar issues. https://www.postgresql.org/message-id/flat/A737B7A37273E048B164557ADEF4A58B50FB8D5E%40ntex2010i.host.magwien.gv.at https://www.postgresql.org/message-id/flat/20200504191201.GU28974%40telsasoft.com I don't know what server version you have, so I don't know whether to suggest testing with plan_cache_mode=force_custom_plan -- Justin