Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gPxeh-0006oL-1q for pgsql-performance@arkaria.postgresql.org; Thu, 22 Nov 2018 22:41:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gPxef-000229-68 for pgsql-performance@arkaria.postgresql.org; Thu, 22 Nov 2018 22:41:01 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gPxee-000220-ND for pgsql-performance@lists.postgresql.org; Thu, 22 Nov 2018 22:41:00 +0000 Received: from mail-it1-x12c.google.com ([2607:f8b0:4864:20::12c]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gPxeZ-0005Hy-8S for pgsql-performance@lists.postgresql.org; Thu, 22 Nov 2018 22:40:59 +0000 Received: by mail-it1-x12c.google.com with SMTP id x19so16013133itl.1 for ; Thu, 22 Nov 2018 14:40:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=9pZEcZQ9nifTGQtkOIeDklQfCzQb1uz8na4UcWV9nz0=; b=GHbecwe0N2A9EhLI5HK3/ETk3S/kE1HVYQPlAjvRX6Pfk6btQHhFIktRypuflEOn5c IXf0l5dz+Atya+bZqvnu1wt0SkXCV5ZnVEvp2tUeqDEJegHlJeOWVnjDXphr0oc3MLNq EesO1bDG2LsmbgajuEi8S6PXph59Q7H7oWTl0qzRFnUY/EJdP7qdnxwqjIHLc19ZdM6J HjgBjzXZ8IQ7v/xU9kk80DdCkQBGrKZ0blUfTuMKw1Cz3HfIYJmrH4z7Vf+kiLmbtPif Z2BmG4DloeH0NW9Pw3jzppHHMkP74E0mrQOqILz9x8YfT5kgvWUEMI6v9UWUPkRqMWmU iUnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=9pZEcZQ9nifTGQtkOIeDklQfCzQb1uz8na4UcWV9nz0=; b=rHLVOp2HbfXHtR+hn8dLPaw7yrDX54aepi5+/bcsgfTg6ZrElzr9azzFnjU7Eeu5Y6 F9vIP/jQXg+zg2wdEarzk2qqHYlbGTOT/Rp6awGdlBDHIm1ohroIRQj8Y3qyONnA0CBM NSJtYn/jDuFnlImt8AizDzRaVdsTNLomBFYzj7dq2fA7BynOq8JvjU3QCtiMvT12MWrn W4KeXVKYzSAtx024wqwiKjilbOsRafBGd3nbNd82LsBk48mzn4aE2E5gxp+UgjgDKg5Q 6TVN2oCOxztonhky5hgs1DWR8emQW/btgrsaZt3f1Elm4pEPtxSN1SaoPEMq2n2bY4P0 UcZA== X-Gm-Message-State: AGRZ1gJVSgcFnvTfiHJhxVIZvXIF2szTL1yCm7GghoU/ux7rBY3abSZ6 h5fAL8mzEL6Mb8fwAWInAcOK/A== X-Google-Smtp-Source: AJdET5dPq+Y3gAzIbQi2OWcZKia0rvYFKKYb4KRypp4Lx3OR3D/ef4/e09yUdErn0EzwokDJxX8nDA== X-Received: by 2002:a05:660c:b4c:: with SMTP id m12mr11209240itl.6.1542926454052; Thu, 22 Nov 2018 14:40:54 -0800 (PST) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id h9-v6sm6345588ioq.55.2018.11.22.14.40.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Nov 2018 14:40:53 -0800 (PST) Received: by pryzbyj (Postfix, from userid 1000) id F1017804FC9; Thu, 22 Nov 2018 16:40:51 -0600 (CST) Date: Thu, 22 Nov 2018 16:40:51 -0600 From: Justin Pryzby To: Abi Noda Cc: pgsql-performance@lists.postgresql.org Subject: Re: Performance impact of updating target columns with unchanged values ON CONFLICT Message-ID: <20181122224051.GK10913@telsasoft.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Thu, Nov 22, 2018 at 01:31:10PM -0800, Abi Noda wrote: > In other words, is Postgres smart enough to not actually write to disk any > columns that haven’t changed value or update indexes based on those columns? You're asking about what's referred to as Heap only tuples: https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/backend/access/heap/README.HOT;hb=HEAD https://wiki.postgresql.org/wiki/Index-only_scans#Interaction_with_HOT Note, if you're doing alot of updates, you should consider setting a lower the table fillfactor, since HOT is only possible if the new tuple (row version) is on the same page as the old tuple. |With HOT, a new tuple placed on the same page and with all indexed columns the |same as its parent row version does not get new index entries." And check pg_stat_user_tables to verify that's working as intended. Justin