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 1rcZpH-000rPw-Qe for pgsql-hackers@arkaria.postgresql.org; Tue, 20 Feb 2024 23:47:04 +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 1rcZpG-001wRV-1P for pgsql-hackers@arkaria.postgresql.org; Tue, 20 Feb 2024 23:47:02 +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 1rcZpF-001wRM-OU for pgsql-hackers@lists.postgresql.org; Tue, 20 Feb 2024 23:47:02 +0000 Received: from mail-178177.yeah.net ([123.58.178.177]) by magus.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rcZpC-000543-FJ for pgsql-hackers@lists.postgresql.org; Tue, 20 Feb 2024 23:47:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yeah.net; s=s110527; h=Message-ID:Date:MIME-Version:Subject:From: Content-Type; bh=FeN8cOdUd4b77+ty0qSyiQTUBjxP0SZYG9we8LTJRk8=; b=mbQZAW/ExzztA4kJBzpXsGr1tBnvftL7rnkwtz9C+brLsPO08+VD1ih5jWyX6U 98wogu1x3/v+/DoB/WIFUqx8+Vk9CqAqKVpB0SoNB0nUIA3q02Q2CBK+yGdU2non +C76cO2Q6j+M6kgXOB9wgX2CKy5YKQZJYqfER5zjTwoiE= Received: from [IPV6:2408:8210:2410:aeb0:14d5:c781:675f:31e3] (unknown [2408:8210:2410:aeb0:14d5:c781:675f:31e3]) by smtp3 (Coremail) with SMTP id sVUQrAD3X+CSOdVlj80oAA--.22867S3; Wed, 21 Feb 2024 07:46:53 +0800 (CST) Message-ID: <954eace7-8fca-4a0e-b05c-2f907e2d081a@yeah.net> Date: Wed, 21 Feb 2024 07:46:53 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Change the bool member of the Query structure to bits Content-Language: en-US To: Tomas Vondra , pgsql-hackers@lists.postgresql.org References: <099cc1b8-c4bd-486a-876d-35c187ee4a1d@enterprisedb.com> From: Quan Zongliang In-Reply-To: <099cc1b8-c4bd-486a-876d-35c187ee4a1d@enterprisedb.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-CM-TRANSID: sVUQrAD3X+CSOdVlj80oAA--.22867S3 X-Coremail-Antispam: 1Uf129KBjvdXoWruw13tr18ZryUXw13KrWfZrb_yoWDZFgE9F W2yFWkCws8XF47Gw4ft3y0gF97KFW3ZF1Utr97Xa42gasxAFW3CFnxGr929w4kXFW7AFsx ur9Yqw4fGr1fujkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IU8UxhPUUUUU== X-Originating-IP: [2408:8210:2410:aeb0:14d5:c781:675f:31e3] X-CM-SenderInfo: htxd06xrqjzxxdqjq5hhdkh0dhw/1tbiDw2KJFnxceVnqgAAsd List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2024/2/20 19:18, Tomas Vondra wrote: > On 2/20/24 11:11, Quan Zongliang wrote: >> >> Sorry. I forgot to save a file. This is the latest. >> >> On 2024/2/20 18:07, Quan Zongliang wrote: >>> >>> The Query structure has an increasing number of bool attributes. This >>> is likely to increase in the future. And they have the same >>> properties. Wouldn't it be better to store them in bits? Common >>> statements don't use them, so they have little impact. This also saves >>> memory space. >>> > > Hi, > > Are we really adding bools to Query that often? A bit of git-blame says > it's usually multiple years to add a single new flag, which is what I'd > expect. I doubt that'll change. > > As for the memory savings, can you quantify how much memory this would save? > > I highly doubt that's actually true (or at least measurable). The Query > struct has ~256B, the patch cuts that to ~232B. But we allocate stuff in > power-of-2, so we'll allocate 256B chunk anyway. And we allocate very > few of those objects anyway ... > > regards > That makes sense. Withdraw.