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 1rS9iK-00BjNI-EA for pgsql-hackers@arkaria.postgresql.org; Tue, 23 Jan 2024 05:52:50 +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 1rS9iJ-009yEv-Io for pgsql-hackers@arkaria.postgresql.org; Tue, 23 Jan 2024 05:52:47 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rS9iI-009yEd-RR for pgsql-hackers@lists.postgresql.org; Tue, 23 Jan 2024 05:52:47 +0000 Received: from m12.mail.163.com ([220.181.12.215]) by magus.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rS9iD-003FTE-D1 for pgsql-hackers@lists.postgresql.org; Tue, 23 Jan 2024 05:52:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-ID:MIME-Version: Content-Type; bh=arPEYRNVzJXMJliEbUCaZT0thRFuubM1xPQh4ePkA0g=; b=UIJ4Gg7dmQfBv+uqI0van5ZI2bMP/ynyC0Hi5hukshH6AHLeeU3uBntUwxJZzI RUU73nlaEHIycn+UdbX+AQfZ4T0M70UssuvFjIvOqoNZW4/j9PreRCveI9SeVZJH v14WHZlj4r1wlT/ScqviXIUz2WoH4tUFN/td6dAub0EyY= Received: from b97369165980 (unknown [140.205.118.232]) by zwqz-smtp-mta-g3-2 (Coremail) with SMTP id _____wDnzxQVVK9l9_elAA--.33180S3; Tue, 23 Jan 2024 13:52:22 +0800 (CST) References: <87il4jrk1l.fsf@163.com> <87h6jxw41k.fsf@163.com> <87sf3andy2.fsf@163.com> <87wmskm9qu.fsf@163.com> User-agent: mu4e 1.10.7; emacs 29.1 From: Andy Fan To: Peter Smith Cc: vignesh C , Matthias van de Meent , Nikita Malakhov , pgsql-hackers@lists.postgresql.org Subject: Re: Shared detoast Datum proposal Date: Tue, 23 Jan 2024 13:44:50 +0800 In-reply-to: Message-ID: <87v87kvboq.fsf@163.com> MIME-Version: 1.0 Content-Type: text/plain X-CM-TRANSID: _____wDnzxQVVK9l9_elAA--.33180S3 X-Coremail-Antispam: 1Uf129KBjvJXoW7KF4fZw45Kry5uw43Jr4kXrb_yoW8trykpr Wavr10kr4kJrZ3tw1DWr10qF10krs3Wr15J3WDJ34Uur15ZF1IkrW8KF4Y9FWku397Ca13 Jay5Xry5Za90vF7anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0zR-18dUUUUU= X-Originating-IP: [140.205.118.232] X-CM-SenderInfo: x2klx3xlid0iqsrtqiywtou0bp/1tbiVAtuU2VOBMVp0AABsw List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, Peter Smith writes: > 2024-01 Commitfest. > > Hi, This patch has a CF status of "Needs Review" [1], but it seems > there were CFbot test failures last time it was run [2]. Please have a > look and post an updated version if necessary. > > ====== > [1] https://commitfest.postgresql.org/46/4759/ > [2] https://cirrus-ci.com/github/postgresql-cfbot/postgresql/commitfest/46/4759 v5 attached, it should fix the above issue. This version also introduce a data struct called bitset, which has a similar APIs like bitmapset but have the ability to reset all bits without recycle its allocated memory, this is important for this feature. commit 44754fb03accb0dec9710a962a334ee73eba3c49 (HEAD -> shared_detoast_value_v2) Author: yizhi.fzh Date: Tue Jan 23 13:38:34 2024 +0800 shared detoast feature. commit 14a6eafef9ff4926b8b877d694de476657deee8a Author: yizhi.fzh Date: Mon Jan 22 15:48:33 2024 +0800 Introduce a Bitset data struct. While Bitmapset is designed for variable-length of bits, Bitset is designed for fixed-length of bits, the fixed length must be specified at the bitset_init stage and keep unchanged at the whole lifespan. Because of this, some operations on Bitset is simpler than Bitmapset. The bitset_clear unsets all the bits but kept the allocated memory, this capacity is impossible for bit Bitmapset for some solid reasons and this is the main reason to add this data struct. Also for performance aspect, the functions for Bitset removed some unlikely checks, instead with some Asserts. [1] https://postgr.es/m/CAApHDvpdp9LyAoMXvS7iCX-t3VonQM3fTWCmhconEvORrQ%2BZYA%40mail.gmail.com [2] https://postgr.es/m/875xzqxbv5.fsf%40163.com I didn't write a good commit message for commit 2, the people who is interested with this can see the first message in this thread for explaination. I think anyone whose customer uses lots of jsonb probably can get benefits from this. the precondition is the toast value should be accessed 1+ times, including the jsonb_out function. I think this would be not rare to happen. -- Best Regards Andy Fan