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 1qGegw-0003ub-El for pgsql-hackers@arkaria.postgresql.org; Tue, 04 Jul 2023 11:59:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1qGegu-0001Gz-AO for pgsql-hackers@arkaria.postgresql.org; Tue, 04 Jul 2023 11:59:32 +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 1qGegu-0001Gp-14 for pgsql-hackers@lists.postgresql.org; Tue, 04 Jul 2023 11:59:32 +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 1qGego-001z3X-Bd for pgsql-hackers@postgresql.org; Tue, 04 Jul 2023 11:59:30 +0000 Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-98e109525d6so1001702666b.0 for ; Tue, 04 Jul 2023 04:59:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; t=1688471963; x=1691063963; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=SXghHSh1o6jD+KQVEjWzkCnC9ouuWNFef4gNTDZmemk=; b=ai+WCQavYnoG5C0LZabaSmvZ3GbEe8GsEo8YjXEW/iGMNFYFRF1baR0mU+1WJqgTJf q/Dj1Gln+ZhleT3lkyw/7nj5/ifKwlW1JfmxtZ4FDXEbLnuanF1fWMQBPknNcQSUNVTZ ypXfc/qIvQj73VXHLVeiR2iA7uMP03Lt3kKWQt1Ky9CjMQKIsIpcZyZy8pkDdKFVvSWf YgwWBMrxNMbhFPft4MQloPVkVRG9Iq080r4DxZLuT3zm8kuxsKUJo/lUUPVx0kCapYjx HsIbbijTEOEhZJaslAazegAN6EuX10fJixEp+pvjq1g7nuUPGb+jGeGL4ALMoGdmo2yl XJEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688471963; x=1691063963; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=SXghHSh1o6jD+KQVEjWzkCnC9ouuWNFef4gNTDZmemk=; b=e3qAm2dFjLpzokxpoRpbCJJTffqDMJB6hOWGBd9trzEbp6TPeOFHZ5DVyQpJ2DVbWe KLlBIrHAMxDvceiVLZwxWjzHZ8nQFRYlTuLVFh6x6Elz9GKknMXJsMTCP+lu1VeiWp/e H0NnNRRwRpD4ASvqY5jy0hqGZ6iVONuHbBEHXWLAR93W+abegYgSp4GpDKHyxEBVhK9+ 2wzZsVcc5EmH5YCLC5TOInKq6E2D1CxxYsriBKE3UOAOYtw0DmJBVTIcckeUB4Da5DLU diDepcgk+1vgB18uzwa4LOrrw7J67w5Cw1FMhN8jj0h6vb6evoT9Gq8FnppJivn2Eak2 UMXQ== X-Gm-Message-State: ABy/qLaILi0a4Pt60YvdiTpZ+TYanFlaHwIPpUhMnStOI7HrkStPXdoh qd20q+yodRCUpsThvvwyshJBFQ== X-Google-Smtp-Source: ACHHUZ7Ek3tW89ACPqjNFRdAvXlj2/Lg0W5W2wc/kGPDrjCIDWQ42+FDWbAQoZu9108z4IBKpMMAnw== X-Received: by 2002:a17:906:46d7:b0:97e:17cc:cc95 with SMTP id k23-20020a17090646d700b0097e17cccc95mr10789993ejs.36.1688471963596; Tue, 04 Jul 2023 04:59:23 -0700 (PDT) Received: from [10.137.0.17] (static-84-42-175-93.bb.vodafone.cz. [84.42.175.93]) by smtp.gmail.com with ESMTPSA id j8-20020a1709062a0800b00992316f0690sm9099647eje.74.2023.07.04.04.59.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 04 Jul 2023 04:59:22 -0700 (PDT) Message-ID: <2b672382-c0b3-3f44-b72c-86b1077b082b@enterprisedb.com> Date: Tue, 4 Jul 2023 13:59:21 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: brininsert optimization opportunity Content-Language: en-US To: Alvaro Herrera , Soumyadeep Chakraborty Cc: pgsql-hackers , Ashwin Agrawal References: <20230704112358.bkm6r3fxp275m4lu@alvherre.pgsql> From: Tomas Vondra In-Reply-To: <20230704112358.bkm6r3fxp275m4lu@alvherre.pgsql> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 7/4/23 13:23, Alvaro Herrera wrote: > On 2023-Jul-03, Soumyadeep Chakraborty wrote: > >> My colleague, Ashwin, pointed out to me that brininsert's per-tuple init >> of the revmap access struct can have non-trivial overhead. >> >> Turns out he is right. We are saving 24 bytes of memory per-call for >> the access struct, and a bit on buffer/locking overhead, with the >> attached patch. > > Hmm, yeah, I remember being bit bothered by this repeated > initialization. Your patch looks reasonable to me. I would set > bistate->bs_rmAccess to NULL in the cleanup callback, just to be sure. > Also, please add comments atop these two new functions, to explain what > they are. > > Nice results. > Yeah. I wonder how much of that runtime is the generate_series(), though. What's the speedup if that part is subtracted. It's guaranteed to be even more significant, but by how much? regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company