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.96) (envelope-from ) id 1w7yBc-0005Ih-08 for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Apr 2026 16:12:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w7yBa-001NfA-2Y for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Apr 2026 16:12:55 +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.96) (envelope-from ) id 1w7yBa-001Nf2-1T for pgsql-hackers@lists.postgresql.org; Wed, 01 Apr 2026 16:12:54 +0000 Received: from mail-qv1-xf2b.google.com ([2607:f8b0:4864:20::f2b]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w7yBY-000000002JF-3Kzl for pgsql-hackers@postgresql.org; Wed, 01 Apr 2026 16:12:54 +0000 Received: by mail-qv1-xf2b.google.com with SMTP id 6a1803df08f44-8a05c18d3e2so11067896d6.1 for ; Wed, 01 Apr 2026 09:12:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1775059972; cv=none; d=google.com; s=arc-20240605; b=daE71yAGFAo5A9Ft8Gslry+qZK0WrPh0g4ZLa2R9FCd/Ko/0bMfv/etoSTt3LOIuZS mPyiL1zU2AlXSqrYmGuHYPgg7x0coP2+a+6DLnKIVx2cFcKajNXJRkL/q3S5+I3jdN6P qatbPIFIWFAFa93Vy6WXbSo4/SISkfVXwo63rQspHSHlVVaiKD9o01HQth0yM9SGCU6w ktG41p+kTX+JD0ChadoJJVqE1X/A+P/fmiz0XCuZ2sQ3DWUPSFn0FbLzlIkwSRtNdo6q bo/Tak81sUL47YktNHCw0xzkd5t5TTYN5LXt3BD4xpPhd1vPHgfB7PXIm55auZXLnMfm 6pNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=D5+m95PUPGJfSmue4U3yBDumwM16LDlmp5UzyGTK6hk=; fh=4wVJctUGG057Ndz70IV5G1+m3YhY/5YPzBhJFt/46Rc=; b=YTJYzfbgDfzIrHK0tZgsv6l+7/qHbid20VRO00uGk2+87wuGAFuHsLXv+FPMp30KPz VjaSkYgU/WvIgIjhIcIoyKSkFVVl4G2Phyjpl2CfeKstUz2YxLwAh09BjaZikKVUOYcX 0sJPESOz+Q6uJCtNakiSDSDEYamYthMIOiZM8DSFlzjCWM5MxeUcDHEPAaJmKWuchfYV GIb+zjDG3qHGahyjrTNxMRJklNz/znBnZzAjp95F4xY8EjozmkAB6o5cezphIC9LfJ5k Uy0+KHhdbTsZaQt/+KKrvZAeYdqKjzFM2z2lFUWQyJ+Gk/BAuNk4/R3U2rkHGSqaSPtF XILQ==; darn=postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775059972; x=1775664772; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=D5+m95PUPGJfSmue4U3yBDumwM16LDlmp5UzyGTK6hk=; b=d6VVwxPCbP5DGfEXIXCXliD78w35TK2rt9bIBBrX0eYZKASr8t2hLctrDCSjcYomQC jGhK9ZW4impGp2UAd0LSbrvTFyFuRyU3Mo7B41DFxBJ62dvQCKSZQe4cd6ToOfgKMIhF N6Sz8h6waxHi9gLMzVplbBzRfTgeM+7B/1Lcd749LA9rj+OGLfywFr7GdupHMWOVdnbq ZzaNX0hkPb9JxKW67tWKrBpGwbO3A1gI+xivBPwkJyOjUirgQYnRnsJ/+GBvUNuaKlHj TUSx0s2NpbX9k1QNsM2K5EtRYj2DWo1h3GO3GJNX/w62rhKUcxqQ0uKdbjIZ7GxU8T6y 63nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775059972; x=1775664772; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=D5+m95PUPGJfSmue4U3yBDumwM16LDlmp5UzyGTK6hk=; b=Y92JAe3fzxmDkRdM1mlMgduYqCuC5VYKWzXl+Pbd2apUbZU3b1tqVhoq5oFAYkiqQa Q9DEK6f/8tfvikl1CIpGAWjQd/yX8jCLMnWB7gOEogCJL2BRu70Ieu5HsLTUNiBvb90q S3/z6yNn/5Xyhtm1UGKeRYWI2YPfkW4WnftAGqS7DE4swkO/dZmml8oV+uqAmjYpWcsI rK8iP39OAazGLMCc+ClxBzfMDIiyA2X6kMQjBJBH1RSNbWAHcfuIYn9MP6dD7nRFn3HD tO47DdI131gFuwqkd1fjjFgeQVvLGnRp5Y5KhtcOIr0RJMicydTcCjDnkKdSkLua08y1 RgHg== X-Forwarded-Encrypted: i=1; AJvYcCV8G6J+f8cno7MfPX1RrFLIteKvDJpCwQM8n1nUL9q+zrCV+TtAKDwqkDgcbCl5w8G4RYlEETUL+ILjFfPr@postgresql.org X-Gm-Message-State: AOJu0YyFsfBnbDg8RvyVxfE+p+iUIQfyH9LfKqlGOKi1ZFuIy0GX91ZO jYrvT+VCtUmvbB3PautKxejp/FEE6Kmyb35+oQTO1Jr1zHSDrkuin7eG0hXeHG6DFrWk8YC5uTx wcjeLry5Zo+rgmjlVdfTqN4OF7R7l6DQ= X-Gm-Gg: ATEYQzyb5ReHa91mTIHhba2dO7dmLRfKpLgj+jHqZfP81Xx92ZdHv9hgylt/hj8ZqZ9 IwY0gRuzn3DnXKDJtMkMWZPnaasiNtzGq6GfIqnY1Wg0ryVwVMY8BWmXLNMfnILfHGoh2UtFy5p 1BVNvEFXnoCFMB1iIQI4C55tzL1cwg8wLuYftkwOMrxphSusg0IFmfqcnXD6iRt7ZsQtwKGq36n vYIcij7+Y6E3u9rlXtgMuCHUyKqchZe6gLS4xj64tUex/aCpXs20fyv5B9XWc3fxdBxA4+DQOzw IO5pGN5RH7Lgvj4MxouDQdkaZNKuE9kl5gcm7sHxBQ== X-Received: by 2002:a05:6214:1d21:b0:89c:7bf8:c564 with SMTP id 6a1803df08f44-8a2cb576a5dmr117262896d6.27.1775059971931; Wed, 01 Apr 2026 09:12:51 -0700 (PDT) MIME-Version: 1.0 References: <20250422181006.dd6f9d1d81299f5b2ad55e1a@sraoss.co.jp> <20250808122125.e9eaff938f8c83556f337e50@sraoss.co.jp> <20250820141028.dc06e0d1d787ce1151f69ed6@sraoss.co.jp> <20250902163341.c174d0e83eedfc54d68b8e9c@sraoss.co.jp> <20251231194455.5975fda68ed8e941e4afb805@sraoss.co.jp> <20260324195727.43416b69c71b5f63eed3b4bc@sraoss.co.jp> <20260325130127.7bc85919861f494ce7c332a5@sraoss.co.jp> <20260327000931.d2303c198c7c9445e90aeab7@sraoss.co.jp> <20260327021807.3ae563de0a288086b98755fb@sraoss.co.jp> <20260327143511.d84a76decfcbd6b80bdf56ed@sraoss.co.jp> <20260327164359.ee19c1e71c80163517a1051e@sraoss.co.jp> <20260331233517.05fbaa30b1b0b96d16b0d556@sraoss.co.jp> In-Reply-To: <20260331233517.05fbaa30b1b0b96d16b0d556@sraoss.co.jp> From: Dean Rasheed Date: Wed, 1 Apr 2026 17:12:38 +0100 X-Gm-Features: AQROBzCsS3nejFXmwgmZxlvSk1uf53DgVMetv2Neg_5EyhOg_eG81ger1OnWIl0 Message-ID: Subject: Re: Allow to collect statistics on virtual generated columns To: Yugo Nagata Cc: Andres Freund , pgsql-hackers@postgresql.org Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, 31 Mar 2026 at 15:35, Yugo Nagata wrote: > > Thank you for updating the patch. I am fine with that. > > One concern is that users might interpret "stored" as referring to > "stored generated columns", rather than including regular columns, Yeah, possibly. I changed "stored" to "non-virtual", which should reduce the chances of that particular confusion. > Also, the meaning of "automatically" might be a bit unclear, so we > could clarify it by adding "without defining extended statistics." > > Defining extended statistics on a single stored > column is not supported or necessary, because statistics are built > automatically on such columns without defining extended statistics. OK, pushed that way. I also noticed that a few places in CreateStatistics() could use the variable "numcols" instead of "list_length(stmt->exprs)", so I changed that. I decided to include the change to the error message discussed in [1], since there seemed to be a consensus there, except that I think it also needs to make it clear that it refers only to non-virtual columns. In addition, there was another nearby error message which was no longer quite right for statistics on virtual generated columns, and I changed the order of checks, since that allowed the "if" statements to be simplified a bit. Regards, Dean [1] https://www.postgresql.org/message-id/20260324203430.411331c59ca462457ec0aa8b%40sraoss.co.jp