Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l2oKs-0005ZJ-BR for pgsql-hackers@arkaria.postgresql.org; Fri, 22 Jan 2021 04:46:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1l2oKr-0006d7-AT for pgsql-hackers@arkaria.postgresql.org; Fri, 22 Jan 2021 04:46:13 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l2oKr-0006d0-46 for pgsql-hackers@lists.postgresql.org; Fri, 22 Jan 2021 04:46:13 +0000 Received: from mail-io1-xd2b.google.com ([2607:f8b0:4864:20::d2b]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1l2oKo-000787-MS for pgsql-hackers@postgresql.org; Fri, 22 Jan 2021 04:46:12 +0000 Received: by mail-io1-xd2b.google.com with SMTP id e22so8729422iom.5 for ; Thu, 21 Jan 2021 20:46:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=5z3hfx3D4wyrNC9oNBBJLDgLgNvamK/fixdIJc1llso=; b=LXfwmYgoS8f5bA7OqJcW+aMMafFoRN5mptu8ZqL5DH+KLOod95crynek1St1MNt57k Keo9WcZt772HL8uK8BbQnI1rNCX8j33eCWFET/WecP5aZWTXjA1gY7jy9KPcVw5JAVyB TmdclJfT+Z/34mVss2lgkcEs5NoyfSsC8R+3tLhhjNYT+ksJObXVb1i/wu2oUoWW3Oov QvG9nIzC6pjBeMLVVfm24Qo8N9ti9jZBi7I4ZNVdNLE7Jx6QqjP+DYaWd6kGv3vQv4Tl qUFuM3vw/RgXMoEbdj4G6cg5OtyvgoQoXSWm+zgfd7BrNC+2Fuyd/ksnDPVmZaGrxjrN Cu4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=5z3hfx3D4wyrNC9oNBBJLDgLgNvamK/fixdIJc1llso=; b=l1JCqSFzHAG7vMfuHDGl5uzKkqShVsJ5NS879s/dkHJz4rkODjoYjOmXdwwo1IYaOA cVc10gc5y/qMVz51YXFWFB2cyQex2ZR3DSiqMtjqcMguS5sckO3i/TOWxbaFuQJ0oGq0 cuGBqFSSkUlzgLH3R0yd9p/EUAJGkL66Yj7edGnTKdfXLv+Npq9S43O1E1djrfvCnBri 43nJDSrLnbuG4/hxrMhTD0QQyg78H3YID2z+7JSC46VvFrb7T45wDv41HV3U2qKAKbyq aQTh+wQWsYXzsJZjZdriPmoZJ9qaeopXI/frNIf94Yur69Y87olOYo6ELWNJheRQkXdJ ESKg== X-Gm-Message-State: AOAM530YkhyHwbRrIH0r6953oXLCI9Wvwm4Cak1HDAJCMzAzInL6uzsv kIIFI40ZZzktGnG6PowMtQ8ydg== X-Google-Smtp-Source: ABdhPJw02Gjfj7mWCWx9W39od8WPDj3cfvtrd3dA/XaUvWnv84lYAf+ticqo8PvrWLPM8HGd8AoN5A== X-Received: by 2002:a02:6014:: with SMTP id i20mr789592jac.101.1611290769168; Thu, 21 Jan 2021 20:46:09 -0800 (PST) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id q5sm4198026ioi.43.2021.01.21.20.46.07 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Jan 2021 20:46:08 -0800 (PST) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 32DFE800928; Thu, 21 Jan 2021 22:46:07 -0600 (CST) Date: Thu, 21 Jan 2021 22:46:07 -0600 From: Justin Pryzby To: Tomas Vondra Cc: Dean Rasheed , pgsql-hackers@postgresql.org Subject: Re: PoC/WIP: Extended statistics on expressions Message-ID: <20210122044606.GG27167@telsasoft.com> References: <20210116232208.GB8560@telsasoft.com> <2f2a3b3b-93e4-723f-144e-bc21f10d6b61@enterprisedb.com> <20210118045331.GF8560@telsasoft.com> <3f20da4d-89dc-0912-98d2-b6f0ef06c87f@enterprisedb.com> <20210122022958.GC27167@telsasoft.com> <20210122040101.GF27167@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210122040101.GF27167@telsasoft.com> User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Thu, Jan 21, 2021 at 10:01:01PM -0600, Justin Pryzby wrote: > On Fri, Jan 22, 2021 at 04:49:51AM +0100, Tomas Vondra wrote: > > > > | Statistics objects: > > > > | "public"."s2" (ndistinct, dependencies, mcv) ON FROM t > > > > Umm, for me that prints: > > > "public"."s2" ON ((i + 1)), (((i + 1) + 0)) FROM t > > > > which I think is OK. But maybe there's something else to trigger the > > problem? > > Oh. It's because I was using /usr/bin/psql and not ./src/bin/psql. > I think it's considered ok if old client's \d commands don't work on new > server, but it's not clear to me if it's ok if they misbehave. It's almost > better it made an ERROR. I think you'll maybe have to do something better - this seems a bit too weird: | postgres=# CREATE STATISTICS s2 ON (i+1) ,i FROM t; | postgres=# \d t | ... | "public"."s2" (ndistinct, dependencies, mcv) ON i FROM t It suggests including additional columns in stxkeys for each expression. Maybe that also helps give direction to response to Dean's concern? That doesn't make old psql do anything more desirable, though. Unless you also added attributes, all you can do is make it say things like "columns: ctid". > In any case, why are there so many parentheses ? -- Justin