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 1oVbEP-0000Xn-KM for pgsql-performance@arkaria.postgresql.org; Tue, 06 Sep 2022 16:15:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oVbEN-0005zA-Ij for pgsql-performance@arkaria.postgresql.org; Tue, 06 Sep 2022 16:15:19 +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 1oVbEN-0005z1-6N for pgsql-performance@lists.postgresql.org; Tue, 06 Sep 2022 16:15:19 +0000 Received: from mail-io1-xd33.google.com ([2607:f8b0:4864:20::d33]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oVbEJ-0000nG-Ac for pgsql-performance@lists.postgresql.org; Tue, 06 Sep 2022 16:15:17 +0000 Received: by mail-io1-xd33.google.com with SMTP id y187so9377814iof.0 for ; Tue, 06 Sep 2022 09:15:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:from:to:cc:subject:date; bh=vmcCRF3bNEhFbZu9AkFTx9M20Ymm6laGPq/UfHRQLWY=; b=tKgUOqAF84M0nQbO9GsMgxEZZpL3q9huQ1dG5033SMW23mHA96DnIyxA2n/9otcD3q HhRH2Tg9Q3teqK+ei8TXnOjhRPHm5w9ueKxwtSlOxn+QYPfcwGWLwNVCbMpmfZ7nhR+z yEBuOUn/FQ/epnXD2tjcaf85dtrFakFSga4pna7bSg/AMB90AhWYUH1SlAuYcDvEmWrF jul4sPRKyEnEGc4R2LUFpH/TGpbxgcPanfK9owABwp6iNILfMVdUT6TN81/qej0uOCgp leUACtap6Aua6Ovz+kDH3/e+sWRNltX17xQqAx7zdejhU34C6ycFN0aCuCM0QayybsRB TSBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date; bh=vmcCRF3bNEhFbZu9AkFTx9M20Ymm6laGPq/UfHRQLWY=; b=Hv4jlKvqNiqHrVHNEq5qN9Og+EQ1PpnXKAsMp5qxiBYp1Ojbp0Nk0aqgxdbGqf0she xUJ9cD0Gxkjim475pONY592WKNwSSWfyQwdpOxvjmn4t+akvxaH+HRMzDPiw87fewWe1 065uDGaA8VG5TKJo3ipnfKMLcq+VZVyQw16emWnblffP/EWsFuavHza3BEi2KScxthY5 ARO6nFMtNN7DhgD4+8CFCWIfCubaqzoMB0QF8PWxeZlca+fwi47D5HhouPAKTnCvsdts UYO7tLUaNlDbE+YygKI3xd+yVOIu4Yxv78IP6mpMWqtsoss8X9F4Y1fjy1Hr0u1HC0oK VThw== X-Gm-Message-State: ACgBeo0vcNh9LdoRxqUR75skcvdqMt5qq7U58MfCSoNHUvpeB612BsQ6 tb3v35yJv09fykXkwNOTNOpmrQ== X-Google-Smtp-Source: AA6agR65dupfawvHc2sT8QVNmlEVFnatF3RUmtHBjXB6cWUObkvrMto8lHFNt6/PI9GBizTVlLb4RQ== X-Received: by 2002:a05:6638:22d1:b0:34f:5d31:5fe with SMTP id j17-20020a05663822d100b0034f5d3105femr10737428jat.185.1662480914183; Tue, 06 Sep 2022 09:15:14 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id o19-20020a92a813000000b002eac9a85b75sm2292014ilh.0.2022.09.06.09.15.13 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Sep 2022 09:15:13 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 06978800DE8; Tue, 6 Sep 2022 11:15:12 -0500 (CDT) Date: Tue, 6 Sep 2022 11:15:12 -0500 From: Justin Pryzby To: "James Pang (chaolpan)" Cc: pgsql-performance@lists.postgresql.org Subject: Re: Postgresql JDBC process consumes more memory than psql client Message-ID: <20220906161512.GQ31833@telsasoft.com> References: <20220905124722.GI31833@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: Archived-At: Precedence: bulk On Tue, Sep 06, 2022 at 04:15:03AM +0000, James Pang (chaolpan) wrote: > We make 2 comparisions between partitioned(256 HASH) and no-partitioned(same data volume,same table attributes) , do same "UPDATE,DELETE " . > 1. with partitioned tables , the "RES" from top command memory increased quickly to 160MB and keep stable there. > From auto_explain trace, we did saw partition pruning to specific partition when execution the prepared sql statement by Postgresql JDBC . > 2. with no-partitioned tables, the "RES" from top command memory only keep 24MB stable there. > Same auto_explain , and only table and index scan there by prepared sql statement by Postgresql JDBC. > 3. with psql client , run the UPDATE/DELETE sql locally, partition pruning works and the "RES" memory" is much less, it's about 9MB . > > Yesterday, when workload test, a lot of Postgresql JDBC connections use 150-160MB memory , so we got ERROR: out of memory How many JDBC clients were there? Did you use the same number of clients when you used psql ? Otherwise it wasn't a fair test. Also, did you try using psql with PREPARE+EXECUTE ? I imagine memory use would match JDBC. It's probably not important, but if you set the log level high enough, you could log memory use more accurately using log_executor_stats (maxrss). > So, looks like something with Postgresql JDBC driver lead to the high memory consumption when table is partitioned , even when table is no partitioned , compared with psql client, it consumes more memory. Any suggestions to tune that ? PG V13 , OS RHEL8 , Virtua machine on VMWARE. We make shared_buffers=36% physical memory , effective_cache_size=70%physical memory , total physical memory is about 128GB. I sent this before hoping to get answers to all the most common questions earlier, rather than being spread out over the first handful of emails. https://wiki.postgresql.org/wiki/Slow_Query_Questions version 13 point what ? what are the other non-default gucs ? what are the query plans ? -- Justin