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 1q4hjI-00088f-98 for pgsql-performance@arkaria.postgresql.org; Thu, 01 Jun 2023 12:48:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1q4hjG-0004Pm-Mz for pgsql-performance@arkaria.postgresql.org; Thu, 01 Jun 2023 12:48:34 +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 1q4hjG-0004OA-7a for pgsql-performance@lists.postgresql.org; Thu, 01 Jun 2023 12:48:34 +0000 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1q4hj9-0034j6-4L for pgsql-performance@lists.postgresql.org; Thu, 01 Jun 2023 12:48:32 +0000 Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-96fe88cd2fcso102957766b.1 for ; Thu, 01 Jun 2023 05:48:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20221208.gappssmtp.com; s=20221208; t=1685623705; x=1688215705; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=tj1HjJocXmNbwyVg4nVomfCTGfaDlui8IXraFo4WB6c=; b=ECBkXWhbYVQe1RQ49dFpD9FIEuPKqbCsCoKOfaVvLkLuxscXXh37E4CzKoLGJZmgo8 LMam9SbQpGaGpZ2c2vh6JF+WRfEvd8unY8jG0nyWhZ8ZsAFc0NBKnJchibXyl2/dBmjL 1mdp7rowP3kXt6Ab2AEWOfvFh8pkBUtaT3HEd0FJENC8ubSk572vF9LLjOGGlHdnCOF3 aFAH6p6Gg13k0nJ40gcPKOl7Eu7+//+htRZ9mSRIyG0Cf6F+tJLbWEH/nxF5+MWGTsqg PDB7+v7P20MeXxvVumgRrvRJQNpRcwA/o64D/2gKJW5om59jVrUJXoDlQQ4DaWZdOc9k a1cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685623705; x=1688215705; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=tj1HjJocXmNbwyVg4nVomfCTGfaDlui8IXraFo4WB6c=; b=K5WTqqa8qeYb+oaRadqJnGQx9Asey0eXEsW0YXLnA5sxpnHGuhgQ45GC8J7wqZXmjs xPgPWPf1q7n6yv5krwHGbwyWbZSKC+lYpgaXZRSV2FRfkLgXvu1s8kSTKQTUQxURNIj/ 7s1jGMd08BqozUBCkJhO1obYtIGaeIQSQarmeuARhOiI/GRMmJ2rn9MisCKtMScXKyaB EyiLOledaTjHOSaitbL71VcUxgKh7q+kNfqxXL3uAVdnWxUQ/XYtGQIfv5KCPrWH03Wu Rm/n2xyqAFgr8S8sElHTI39R5DbZ7t8DCVFKOdY7Q53LtKTc3ZHcb5CuzXYN8Qx0whzO JNhA== X-Gm-Message-State: AC+VfDxUwjWr7qdAVHmW37XlXDgA3tjsVayrk33cO8D/cJIXHplJJXhY kO342n0fvU9cJ4tuZtDigNmEpg== X-Google-Smtp-Source: ACHHUZ4Xlor1EF5vnkYv7tNGH1WE1vt3UYd6C398usWuWqCJob5eCkxqRlIFI/Gu+uD0jBkm2t4O0g== X-Received: by 2002:a17:907:3e8f:b0:96f:181b:87d3 with SMTP id hs15-20020a1709073e8f00b0096f181b87d3mr9126949ejc.37.1685623704768; Thu, 01 Jun 2023 05:48:24 -0700 (PDT) Received: from localhost.localdomain ([2001:871:5e:e788:ec0f:bb76:46ee:40fc]) by smtp.gmail.com with ESMTPSA id ci15-20020a170906c34f00b009658264076asm10387026ejb.45.2023.06.01.05.48.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jun 2023 05:48:24 -0700 (PDT) Message-ID: <7bbe7bf1fa86dc075d2b655fdadd08fa99180212.camel@cybertec.at> Subject: Re: thousands of CachedPlan entry per backend From: Laurenz Albe To: "James Pang (chaolpan)" , Pavel Stehule Cc: "pgsql-performance@lists.postgresql.org" Date: Thu, 01 Jun 2023 14:48:23 +0200 In-Reply-To: References: <9513916420a6c0a00eb5ecacfba984e2e5a97e0d.camel@cybertec.at> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.4 (3.46.4-1.fc37) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, 2023-06-01 at 08:50 +0000, James Pang (chaolpan) wrote: > we found thousands of cached plan , since JDBC driver only allow max 256 = cached > prepared statements, how backend cache so many sql plans. If we have one = function, > when application call that function will make backend to cache =C2=A0ever= y SQL statement > plan in that function too? =C2=A0=C2=A0and for table triggers, have simil= ar caching behavior ? Yes, as long as the functions are written in PL/pgSQL. It only affects static SQL, that is, nothing that is run with EXECUTE. Yours, Laurenz Albe