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 1qH8Ta-0008Ne-Ds for pgsql-hackers@arkaria.postgresql.org; Wed, 05 Jul 2023 19:47:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1qH8TZ-0003Sx-3r for pgsql-hackers@arkaria.postgresql.org; Wed, 05 Jul 2023 19:47:45 +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 1qH8TY-0003Sn-OG for pgsql-hackers@lists.postgresql.org; Wed, 05 Jul 2023 19:47:44 +0000 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qH8TV-002DqS-TK for pgsql-hackers@lists.postgresql.org; Wed, 05 Jul 2023 19:47:43 +0000 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-3fbc1218262so86357575e9.3 for ; Wed, 05 Jul 2023 12:47:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20221208.gappssmtp.com; s=20221208; t=1688586460; x=1691178460; 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=11lKFVfKP/2Uz8TarHEXa0pZWruwnd/bVCWb4lL1Hrk=; b=yGX0pefVT39buCNkfHbY6o4RmRkUWsuzVNT/gy8bRPkb8i4lW2jlPdKB+EreIbr6ZH eaonK6lbeprZya0ROnc6UyQfoNy+uN0iJa35nRf4drqKe5T70wZlF/pexlyJyqMnNIEx 5Pm0GFwwsmKlQlE9TEZofEcBRj0Vr6vdFuCK2J1Gf/iyUuPrHCr+RDTeADcpSYCK2aVy 5Sto4r5NnOLce2vfw2wv5xFYbuqWLKleEpRnFVgeZQtGXxi7xxeK9U4udKXTF3bi8LVu L9BOHXUkEm9ttX5kaVBnAO/QZzhEy3ASrFH1PZBlmEhg7OF692xrhLFqb40dDTy+q+Vn A/dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688586460; x=1691178460; 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=11lKFVfKP/2Uz8TarHEXa0pZWruwnd/bVCWb4lL1Hrk=; b=BWtLrHWPNctpmrnS85igt5yu+UzIAd7hgRlbHSWLcjjVnE9Bn5p+jL+VjGuqwqz7jH 60w40foOp8nQKsEXCAjk8qF7P3ZuClSTHlLU7w/7v5+KkQHW/nz+JrDXT1wA705bvYks 1Cd0XTiv1FWDcL9JrQmjI2fqT33cd6nBVLR0GvLbBkwZ9x95v3O8y0eyBWbjE6TYntuA O9/05xE0n/ctD1OI+cPaeI2KWaZ3KVs0FVat5xMsXRr0EvnwwT3iW3bNl76DJTWX/AZB R9GOPn0J/ffvnnyv4k7Lv6oVsi55wb5xplFtVYzzLm8205fQhWUtcTRizlcwzIGD/MMU bp+g== X-Gm-Message-State: ABy/qLaN3xVOEjQVwEUHbAIuhqpZnpCTqlmj+fxo1wYOvp2z4nVB3DkC 4QxBnCL+pG1AuA76Q+0QrGW42g== X-Google-Smtp-Source: APBJJlFkW6/XYJwb3RyNfZboCcwWJQsL4Sn/hsVC3/x8BHmRjTHl2XXmHZhanJPM1k+wzn4BAlFNMg== X-Received: by 2002:a1c:cc1a:0:b0:3fb:ef6f:9231 with SMTP id h26-20020a1ccc1a000000b003fbef6f9231mr263624wmb.11.1688586459887; Wed, 05 Jul 2023 12:47:39 -0700 (PDT) Received: from localhost.localdomain (178-190-169-106.adsl.highway.telekom.at. [178.190.169.106]) by smtp.gmail.com with ESMTPSA id u22-20020a05600c00d600b003fbb9339b29sm2964469wmm.42.2023.07.05.12.47.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jul 2023 12:47:39 -0700 (PDT) Message-ID: <4f286c03f91b73e07f215e05dccc87619266b3d7.camel@cybertec.at> Subject: Re: Disabling Heap-Only Tuples From: Laurenz Albe To: Thom Brown , Matthias van de Meent Cc: PostgreSQL Hackers Date: Wed, 05 Jul 2023 21:47:38 +0200 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 Wed, 2023-07-05 at 12:02 +0100, Thom Brown wrote: > On Wed, 5 Jul 2023 at 11:57, Matthias van de Meent wrote: > > On Wed, 5 Jul 2023 at 12:45, Thom Brown wrote: > > > Heap-Only Tuple (HOT) updates are a significant performance > > > enhancement, as they prevent unnecessary page writes. However, HOT > > > comes with a caveat: it means that if we have lots of available space > > > earlier on in the relation, it can only be used for new tuples or in > > > cases where there's insufficient space on a page for an UPDATE to use > > > HOT. > > >=20 > > > Considering these trade-offs, I'd like to propose an option to allow > > > superusers to disable HOT on tables. The intent is to trade some > > > performance benefits for the ability to reduce the size of a table > > > without the typical locking associated with it. > >=20 > > Interesting use case, but I think that disabling HOT would be missing > > the forest for the trees. I think that a feature that disables > > block-local updates for pages > some offset would be a better solution > > to your issue: Normal updates also prefer the new tuple to be stored > > in the same pages as the old tuple if at all possible, so disabling > > HOT wouldn't solve the issue of tuples residing in the tail of your > > table - at least not while there is still empty space in those pages. >=20 > Hmm... I see your point.=C2=A0 It's when an UPDATE isn't going to land on > the same page that it relocates to the earlier available page.=C2=A0 So I > guess I'm after whatever mechanism would allow that to happen reliably > and predictably. >=20 > So $subject should really be "Allow forcing UPDATEs off the same page". I've been thinking about the same thing - an option that changes the update strategy to always use the lowest block with enough free space. That would allow to consolidate bloated tables with no down time. Yours, Laurenz Albe