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 1l2wBg-0008Jy-58 for pgsql-hackers@arkaria.postgresql.org; Fri, 22 Jan 2021 13:09:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1l2wBf-0001xJ-24 for pgsql-hackers@arkaria.postgresql.org; Fri, 22 Jan 2021 13:09:15 +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 1l2wBe-0001xC-Rb for pgsql-hackers@lists.postgresql.org; Fri, 22 Jan 2021 13:09:14 +0000 Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1l2wBY-0002qH-F9 for pgsql-hackers@postgresql.org; Fri, 22 Jan 2021 13:09:13 +0000 Received: by mail-ed1-x536.google.com with SMTP id c6so6512827ede.0 for ; Fri, 22 Jan 2021 05:09:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=cs2FvCM6qZqASs8c/tnr1CrDvkvRxjqjN5+f0HE+rJQ=; b=Z+2TrEspgekph/8z2fbb68/7E7HrVlFZAeGXjp1ZqJFuMO9Tdj3h9vHXXMreHnxXXm FGYsCJyYp1cnfyQvRAtJzEkDc1jtvdL96uZKiaymMUwBUHCyjZMwONLSw03TYaZp733y eJ8j2AxG1hP70Uc8RdQm27ejGuvb81Z7lhohxfVtZx44L/Mmw22Zqcb3yLB2xtdsoX+F S/l5qh/q+bHpGZZn5gSz9l61DlCQRzyoEwdyTPcQdL+RCTeQqd2AAllbXnVhA0oQynpa 6TQKt01A4Kdk8W1pg8IlKj8PoUfFIPLW9w1sDlfP/Sa3S0NEhorQ0zCiiZrzrstjOMTL o4wQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=cs2FvCM6qZqASs8c/tnr1CrDvkvRxjqjN5+f0HE+rJQ=; b=okHppY1Ij//pL2IIuKqMCdoT64HjgOe1uk7SbMkC2ZYhF5csCijvNPtckxRYRg74PB fbZn47xtWs5v/02PS0GTnDaAczH4yeCb3/P6N+GvZPVyHPDP540qTj3hgqQBadN1UnDb JF4PhIaOIqPgMPf3pJdFaL59arV3FVHZiBCCEJgpGKvtKdO92Twf6kE/+U9fBtMDZZUR E5kgu9lfqUV9AplWznPDBzHjgookW+IjYMflfByhE4NbIPxB7f9510RHEH1NjTvaOyL7 P87E28SVzQeNHEjAqwThjO7QE08lPP3lPx0SXsbiTK0Abchx7sW3MRu3Uk/BF39n0UuR zfXw== X-Gm-Message-State: AOAM530HJuXiW3K0JuGQbvW1cbchwFrcQ6BH/d9CrpsVOHq/2N8mGS1O PGccfxXTE66bZMWezZdb+6VPKIfscIflIfJkyXBH8ZGJ2+ScTqA7XuX82yzwAZySLx090Ul0qoh 9vq741Iz/ws0MBF+AFDq56/wNAXwTLHOC63AfCS42pl2AqGwxi+xo9S4osiLe4P8HVPZSjYLV1l QdkHoiaXa82vlnEpI/THG0EGlLLThiGM5VXNIgQQLVJDzUVSnctbUtQDl2DgLwcRrULbiZmeFSD kzho5tLOR2xXzBDsJ37ZDEHu75T5fpDnhCBew== X-Google-Smtp-Source: ABdhPJzsGsfetTdNaml6tgK4YMp/U4ro+Fo473UmLnHsQHn2jWqDnwuRT/sV6xuvQ8/voPMlEpmclQ== X-Received: by 2002:aa7:cdcb:: with SMTP id h11mr3153637edw.237.1611320946648; Fri, 22 Jan 2021 05:09:06 -0800 (PST) Received: from [10.137.0.20] (ip-86-49-253-127.net.upcbroadband.cz. [86.49.253.127]) by smtp.gmail.com with ESMTPSA id x17sm5173810edd.76.2021.01.22.05.09.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 22 Jan 2021 05:09:05 -0800 (PST) Subject: Re: PoC/WIP: Extended statistics on expressions To: Justin Pryzby Cc: Dean Rasheed , pgsql-hackers@postgresql.org References: <5305f9cf-3927-06c4-cd5b-e46cbc58bc7f@enterprisedb.com> <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> From: Tomas Vondra Message-ID: <04b100f9-201b-0bc8-c613-0f918451b599@enterprisedb.com> Date: Fri, 22 Jan 2021 14:09:04 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <20210122040101.GF27167@telsasoft.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-CLOUD-SEC-AV-Info: enterprisedb,google_mail,monitor X-CLOUD-SEC-AV-Sent: true X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 1/22/21 5:01 AM, 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. > Well, how would the server know to throw an error? We can't quite patch the old psql (if we could, we could just tweak the query). > In any case, why are there so many parentheses ? > That's a bug in pg_get_statisticsobj_worker, probably. It shouldn't be adding extra parentheses, on top of what deparse_expression_pretty does. Will fix. regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company