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 1jPEfo-0005vE-BW for pgsql-general@arkaria.postgresql.org; Fri, 17 Apr 2020 00:16:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jPEfl-0001dR-Um for pgsql-general@arkaria.postgresql.org; Fri, 17 Apr 2020 00:15:57 +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 1jPEfk-0001dJ-1c for pgsql-general@lists.postgresql.org; Fri, 17 Apr 2020 00:15:57 +0000 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jPEfg-0002rM-Af for pgsql-general@postgresql.org; Fri, 17 Apr 2020 00:15:54 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 6D69E784; Thu, 16 Apr 2020 20:15:50 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 16 Apr 2020 20:15:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm2; bh=Y xCF0itbEaPYN1iy+N100O2wHLAQqRcgsrlQg4k84yk=; b=fC2goaHHujfamF7lV C+r87RDIPC1im/ib0PfsibN0Nz0H13fmaBijG3op134iZhp2cPMBHOXNgPaOl94q hd6t5zurMwZQdJ+4VPF/ljjSdK/kCkXzPno7ptEvI++eXequ8JYZ79YISHEs+BzO nFf7bEryh544Vi87lZYfuBPGxDISEAOkbHEN0vYrkNHrRuvsNHFeSmDAl5Jkqq4M Kr2xpGVb7v1UDEVFGXdnJF7O0yJMDtljDFdAvfpbXMoyyubdtjfIiHw96SKEAVJp F/aNJp2g3RCLpTd8I9RacPVryXqW20orWA1KfRMKNfkY0YJ/UbpgU3jS+iJ/MnCk SB9rg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=YxCF0itbEaPYN1iy+N100O2wHLAQqRcgsrlQg4k84 yk=; b=AR5EgvW1k3V6wqPSLamms0lnnr24sg++5JYU7LL1xM47ytptEk5DRfJDe xjxYeQct/mj6dYqR3jPR0BZBLBwdxVtxOVUuf/ownDkaE6SuWMqawLd3/QtTUzYk 7xaDUFjEckI1BYUAx89oITcxCgNywM32YbIqsm2aFQtg/kaIK2/EfUv59VdmG+Gr MCXNycUKvtRYFtZsM0hfvXpp7BiemChyz3w/MhacDlZ2HcJ95uU1ChMzIvGRVfyn 1bAVfvpNRnuVUx1ufHNcg/PWMibnsiCd8rsIB7Zf7uVzYnx9ALgPoVi6unJY2ri4 DI8o68YTic0nOMWzWn/Re4QkLjDJw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrfeeigdefvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefuvfhfhffkffgfgggjtgfgsehtkeertddtfeejnecuhfhrohhmpeetughrihgr nhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh eqnecukfhppeeljedruddufedrvddtjedrudefkeenucevlhhushhtvghrufhiiigvpedt necurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhlrg hvvghrrdgtohhm X-ME-Proxy: Received: from [192.168.1.10] (97-113-207-138.tukw.qwest.net [97.113.207.138]) by mail.messagingengine.com (Postfix) with ESMTPA id 374AD3280065; Thu, 16 Apr 2020 20:15:49 -0400 (EDT) Subject: Re: performance of first exec of prepared statement To: Ted Toth , pgsql-general References: From: Adrian Klaver Message-ID: <46565270-f610-a7ef-eff2-75e23ca27bcb@aklaver.com> Date: Thu, 16 Apr 2020 17:15:48 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 4/16/20 4:59 PM, Ted Toth wrote: > > > On Thu, Apr 16, 2020 at 6:29 PM Ted Toth > wrote: > > I've noticed that the first exec of an INSERT prepared statement > takes ~5 time longer (I'm using libpq in C and wrapping the calls to > time them) then subsequent exec's is this the expected behavior and > if so is there any thing I can do to mitigate this affect? > > Ted > > > For example (in my environment) I'm seeing the prepare take ~10ms, the > first exec take ~30 ms and subsequent exec's take ~4 ms. > I don't have an answer. I believe though that to help those that might it would be helpful to show the actual code. -- Adrian Klaver adrian.klaver@aklaver.com