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 1pXeut-0004ky-47 for pgsql-general@arkaria.postgresql.org; Thu, 02 Mar 2023 09:07:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pXeur-0008Hr-6G for pgsql-general@arkaria.postgresql.org; Thu, 02 Mar 2023 09:07: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 1pXeuq-0008Hh-NI for pgsql-general@lists.postgresql.org; Thu, 02 Mar 2023 09:07:56 +0000 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pXeuj-0007Ut-Pn for pgsql-general@lists.postgresql.org; Thu, 02 Mar 2023 09:07:55 +0000 Received: by mail-wr1-x434.google.com with SMTP id h14so15779934wru.4 for ; Thu, 02 Mar 2023 01:07:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20210112.gappssmtp.com; s=20210112; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date :message-id:reply-to; bh=ZkCq1UlviInQyzSncXsZxjvUPHGLfx8JoI1CdOwp+eY=; b=QCYPswUg1b6DpulzQRq3Zdi9iTSHxqav0meoIxW7vffvhDWZPNKSsvUtgOt/jt4dK9 UWaEryPU/9YNS8sV/OEXlvaSmTJuaUgyiM+OxnGPYdsBijxiy2vWXzAFwMijvSdMIFFq GH950NP/E1jGoD1d3sFp7pg1uGOZvO2CsWe0nV0USRrNYanuVvAEBjdYLpatA1Oxo61+ uOG3SQRQVbRyiCp6KBRntx0ayr3mJRybF6LsTQ8mSLyjTXA26DvMzePohpfYKh4+Gnnp EfqvIVypxaaW6QdEvFwGwG6WbLTCjfZ2kPp1dDcAELxFLXrFWt0QG7bbn7xPwURZ82sn y/eQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=ZkCq1UlviInQyzSncXsZxjvUPHGLfx8JoI1CdOwp+eY=; b=y9Xrk/jwhooeOQZgwQHWppWklUtlyb5FmO5QXWujHhiuBMcVflKtb11XqUFJoj5iyf ip+AX4YBxDg5JqgoWEc2OOT28GWNOBMHxoC5TLYtNIWCIZE363tWw3q1gx9AhRanrLYq C3GXUKfzXFujEQapWD6hOqAIoIaRh143WGOj+zLNRTgo2WDJHv8DlQoaDYJWdzIAsS/b OE8mWp2vGn5+6i7Yd1UY4sGDU1upPW9lgLdRva+VSvVuvGlqxMMJmlo3sWlCow0LbTx0 +rbA0trI9/xjZSKrH3w17zcZGY2HImFrkXjH9o4khVhvpZz5/IUZWG1mtAdajMCRD+Ah h+IQ== X-Gm-Message-State: AO0yUKWBCfKkszYvtYDgai1I8Nnb+Du4oTV24s9Kiill4DqpuK0Hm+dN Rrdo6nOu7s6vXElGthdsA3oq+oXYhpm+8UNm X-Google-Smtp-Source: AK7set/c7HJckqSt20HM5+PCexGMkJPji7a0UAfQ1Y82g2tiXLz+Z/V0+QTGx3Og2HFvD15TVkxygw== X-Received: by 2002:a5d:510f:0:b0:2c7:1c31:2348 with SMTP id s15-20020a5d510f000000b002c71c312348mr7562163wrt.19.1677748068044; Thu, 02 Mar 2023 01:07:48 -0800 (PST) Received: from dynamic-pd01.res.v6.highway.a1.net ([2001:871:5e:539:1b2c:c52a:475d:310c]) by smtp.gmail.com with ESMTPSA id a2-20020adfdd02000000b002c3f03d8851sm14963468wrm.16.2023.03.02.01.07.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Mar 2023 01:07:47 -0800 (PST) Message-ID: <2da7581775414e7a9f0c6caa69ac0d602ba70e61.camel@cybertec.at> Subject: Re: Postgres Index and Updates From: Laurenz Albe To: Navindren Baskaran , pgsql-general@lists.postgresql.org Date: Thu, 02 Mar 2023 10:07:46 +0100 In-Reply-To: References: 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-03-02 at 15:53 +0800, Navindren Baskaran wrote: > We would like to understand in which scenario an index on a table will be= rebuilt. I assume that you are meaning "updated" or "modified" rather than rebuilt f= rom scratch. > Example if we have a table, which has two columns and one if it is indexe= d, > which of the below operation trigger an index rebuild: >=20 > 1. updating the value of the indexed column. > 2. updating the value of the non-indexed column. If the indexed column is updated, a new index entry has to be added. If the other column is updated, it depends. If the updated column is not indexed and there is enough room for the new row version in the same table block, the index doesn't have to be modified. Otherwise it is. See https://www.cybertec-postgresql.com/en/hot-updates-in-postgresql-for-be= tter-performance/ Yours, Laurenz Albe