Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1stN8Z-00Fhj6-W0 for pgsql-hackers@arkaria.postgresql.org; Wed, 25 Sep 2024 08:12:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1stN8X-005J2f-Vb for pgsql-hackers@arkaria.postgresql.org; Wed, 25 Sep 2024 08:12:37 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1stN8X-005J2X-Hq for pgsql-hackers@lists.postgresql.org; Wed, 25 Sep 2024 08:12:37 +0000 Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1stN8Q-000xQK-Px for pgsql-hackers@postgresql.org; Wed, 25 Sep 2024 08:12:36 +0000 Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-a8d56155f51so768669066b.2 for ; Wed, 25 Sep 2024 01:12:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20230601.gappssmtp.com; s=20230601; t=1727251949; x=1727856749; darn=postgresql.org; h=message-id:date:content-transfer-encoding:content-id:mime-version :comments:references:in-reply-to:subject:cc:to:from:from:to:cc :subject:date:message-id:reply-to; bh=Mw50QHTh9xRZuWQk7OA7spsRF02o/+75uyJndOi+S5o=; b=iHjQor8mdQjAhhCZroAYZE8tdH5lzbt3nlnNmzy4tky6o8VLdB9+syLQD4n9v1iHzU lHOfqlDQFr27Q8/0YgdM6PNMpOwgPqGXq26S8GgzvWXYrX5flptBJMLNFyzhTDS51kLv 7TdMNZ9DWWlH9JDfY3xETN+UJQ9rVzEM2q4D0ZMquC7UfgoEzb6HFS4C2PEFFOiSpO8l sFd+qiPFlKnxAMuVtZYAKxEdtuPLaNYwZl3Z32nqN1FMWulZ/GOyBSgJPu+TuQFJNvZd l3mq0ijKH7+KYimIYEjoL94FJRPgsWUal9FKr3g1wWHqcCKyqHf0d6052SF4j+DpkVO4 Bl/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727251949; x=1727856749; h=message-id:date:content-transfer-encoding:content-id:mime-version :comments:references:in-reply-to:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Mw50QHTh9xRZuWQk7OA7spsRF02o/+75uyJndOi+S5o=; b=qVNOO+MpzE2wSKXIT5IergjpmC4jMRclRqvSqTtMuBSGZQoxLJ9KYwjd+51WnMMYkW GcUofU1iAxs+53Y1Nejfq/8pxTOaOJYulyQ6wMydC1agOfBWIgbCOz6sZy49GIppqV8y gUpPHvD/Q3mj1hZp+6GKa4Rq8erNshiEDYplPLM7icXE9Hln/surWmiKZgqT2cA3ejpD xLU+0r/s7a7rezKza0YRbzBLr4CW8mxA73FJokgjKhtJCvQJRIuVIQ+LzKC8Urkux/SU Ijv94uHBUDXA20zrHJpFnhx98kNGMI/zaL3JHofTK2ULMkAl37SThO+MK22O87fQcuyD rcqA== X-Gm-Message-State: AOJu0YxkC45PyGDaOrgwdR7x4R39bzTHgSmgI7jCOqfwy7zR+eanlJVl nuT/SSCxvRPkrHaeQn0X+FHK7P1xtzFA0IFKzm9E/8/PTEE7qRlbR921BYma9v4= X-Google-Smtp-Source: AGHT+IGESqIDhKJE9uIroPTQnWnBMZxIqJtu50hHoCSSqiysfXniGX1VrZ6I41vtQtOyLENH95D/bw== X-Received: by 2002:a17:906:c107:b0:a72:50f7:3c6f with SMTP id a640c23a62f3a-a93a0383da8mr164046466b.14.1727251948616; Wed, 25 Sep 2024 01:12:28 -0700 (PDT) Received: from antos (109-81-174-135.rct.o2.cz. [109.81.174.135]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a93931348cfsm180007366b.200.2024.09.25.01.12.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Sep 2024 01:12:28 -0700 (PDT) From: Antonin Houska To: Andres Freund Cc: pgsql-hackers@postgresql.org, Noah Misch , Heikki Linnakangas , Robert Haas , Thomas Munro Subject: Re: AIO writes vs hint bits vs checksums In-reply-to: <2305.1727247975@antos> References: <2305.1727247975@antos> Comments: In-reply-to Antonin Houska message dated "Wed, 25 Sep 2024 09:06:15 +0200." X-Mailer: MH-E 8.6+git; nmh 1.8; GNU Emacs 28.2.50 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2738.1727251947.1@antos> Content-Transfer-Encoding: quoted-printable Date: Wed, 25 Sep 2024 10:12:27 +0200 Message-ID: <2739.1727251947@antos> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Antonin Houska wrote: > Andres Freund wrote: > = > > What I'd instead like to propose is to implement the right to set hint= bits as > > a bit in each buffer's state, similar to BM_IO_IN_PROGRESS. Tentativel= y I > > named this BM_SETTING_HINTS. It's only allowed to set BM_SETTING_HINTS= when > > BM_IO_IN_PROGRESS isn't already set and StartBufferIO has to wait for > > BM_SETTING_HINTS to be unset to start IO. > > = > > Naively implementing this, by acquiring and releasing the permission t= o set > > hint bits in SetHintBits() unfortunately leads to a significant perfor= mance > > regression. While the performance is unaffected for OLTPish workloads = like > > pgbench (both read and write), sequential scans of unhinted tables reg= ress > > significantly, due to the per-tuple lock acquisition this would imply. > = > An alternative approach: introduce a flag that tells that the checksum i= s > being computed, and disallow setting hint bits when that flag is set. As= long > as the checksum computation takes take much less time than the IO, fewer= hint > bit updates should be rejected. Well, the checksum actually should not be computed during the IO, so the I= O would still disallow hint bit updates :-( -- = Antonin Houska Web: https://www.cybertec-postgresql.com