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 1rcO9H-002bWi-MX for pgsql-hackers@arkaria.postgresql.org; Tue, 20 Feb 2024 11:18:55 +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 1rcO9G-0044lP-9T for pgsql-hackers@arkaria.postgresql.org; Tue, 20 Feb 2024 11:18:54 +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 1rcO9F-0044lH-VO for pgsql-hackers@lists.postgresql.org; Tue, 20 Feb 2024 11:18:54 +0000 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rcO9B-007j4G-JD for pgsql-hackers@lists.postgresql.org; Tue, 20 Feb 2024 11:18:52 +0000 Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-512b42b6697so2265238e87.1 for ; Tue, 20 Feb 2024 03:18:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; t=1708427928; x=1709032728; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=X1Uai6Koc9XOke4ic6YJ/XyY9mNO6jNVbT+LSWOEr9Q=; b=QNSWQLkiLKXCrz8p+PT8QNWgYtW+HzOPphjZnQ/UMygMdQHcxoP+6V8har4VImxKPs wrBC+zWyXQ2Vj9QO9AOPays+yzRLDHEvRYF+/uinAHVDQDup6vCHWGTsn4WdRjvXh8af myPyZuUuCL4pTeqLVWhykgaSdWJ5krWaJYJKuZexLfJz9xNXnvyyYF70sYDaBbc9LvAW xbMt5IAGtHy8PUlXg7sZ+TrSJ2y3BdhCXXJ32FMNRPahKElf0ZBDxj1+Ew2JoSY07wN6 BQVfAYbffCTPSqUhXJJ1oKoftGZ/x9zG6cx44DGK9tYkTAqODusQCoXaWddA0ZII4I2G +UhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708427928; x=1709032728; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=X1Uai6Koc9XOke4ic6YJ/XyY9mNO6jNVbT+LSWOEr9Q=; b=ECr1EZztdeUABKRYp8VzyvddhnKcGsvQ0wBp8ZDQpDWdPmpxSmIrxuEJ4TkfB/Yc4Z 432753hsnqblGkqwlC457hfqMEHilTfkdwPXur7XpM/XqBNZ+j826FOjOAj51pxwuJlE KFjxb5kUhjpa8g+59R3zgBUyRruaDrY2qwfOsbSLfKo1iVY19i3uB0q+r+X37izPmHg2 BLB0EXy77Ow0ZjqiHYRPtneiN8c3Qhxy9v/V+3UplB2ulv7vO6MZ1UsMlELJpWGXyfxJ Qp6miKjoCn7Sube8vZMbTTrNdN0e6yNJUoXXuRwb4KFb9PxrbsPaahNnunHgmRtwMKHR Ff6w== X-Forwarded-Encrypted: i=1; AJvYcCXyvDCITRB50b0+bVF4cs5k2t/NsNhNuBuJ+WDA4QIDh+nkuxsJX44ug00Eo29Rfxo77+chEdfjLQZxL/hLfuFIcfWIFga+axJsGTAM1OEVQdEz X-Gm-Message-State: AOJu0YzpHbhaIMJxzyoIb74Xpzqg+tOQ1clWs3JE3SOi8fOc70ML86Ui MsX6TZeA51mCHsqDPpy5LVUVqju3OH66pKqTXJEWnH3hzmgSLztv09kgeb5eug== X-Google-Smtp-Source: AGHT+IHs5JFtbkMhCK7ZbuEXTgy8ENo+r2suk0QZN0hlajkmN951H5IhUSBYM+qbZYIWCP3620CMWw== X-Received: by 2002:ac2:48ae:0:b0:512:a959:759b with SMTP id u14-20020ac248ae000000b00512a959759bmr4445353lfg.35.1708427927743; Tue, 20 Feb 2024 03:18:47 -0800 (PST) Received: from [10.137.0.18] (ip-86-49-229-30.bb.vodafone.cz. [86.49.229.30]) by smtp.gmail.com with ESMTPSA id u19-20020a05600c19d300b004126ca6c241sm2767223wmq.23.2024.02.20.03.18.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 20 Feb 2024 03:18:47 -0800 (PST) Message-ID: <099cc1b8-c4bd-486a-876d-35c187ee4a1d@enterprisedb.com> Date: Tue, 20 Feb 2024 12:18:46 +0100 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: Quan Zongliang , pgsql-hackers@lists.postgresql.org References: From: Tomas Vondra In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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 -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company