Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d1Yyq-0000UI-S7 for pgsql-hackers@arkaria.postgresql.org; Fri, 21 Apr 2017 13:52:12 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1d1Yyq-0005QA-F5 for pgsql-hackers@arkaria.postgresql.org; Fri, 21 Apr 2017 13:52:12 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1d1Yyp-0005PA-AZ for pgsql-hackers@postgresql.org; Fri, 21 Apr 2017 13:52:11 +0000 Received: from www4.webmail.pair.com ([66.39.3.58]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1d1Yym-0004Lj-B4 for pgsql-hackers@postgresql.org; Fri, 21 Apr 2017 13:52:10 +0000 Received: by www4.webmail.pair.com (Postfix, from userid 65534) id E6803B424D6; Fri, 21 Apr 2017 09:52:05 -0400 (EDT) Received: from 87.78.248.233 ([87.78.248.233]) (SquirrelMail authenticated user te_123@bloodgate.com) by sm.webmail.pair.com with HTTP; Fri, 21 Apr 2017 09:52:05 -0400 Message-ID: <30cb51463a0ede7ce706c958537dca3a.squirrel@sm.webmail.pair.com> In-Reply-To: References: <20170420212426.ltvgyhnefvhixm6i@alvherre.pgsql> <22269.1492726397@sss.pgh.pa.us> <724d39fc-b7e9-7634-21e1-ebdba6f73bd6@2ndquadrant.com> <703b449ecd188a16d5e12a1fcb6158bf.squirrel@sm.webmail.pair.com> Date: Fri, 21 Apr 2017 09:52:05 -0400 Subject: Re: WITH clause in CREATE STATISTICS From: "Tels" To: "David Rowley" Cc: "Tomas Vondra" , "PostgreSQL-development" User-Agent: SquirrelMail/1.4.23 [SVN] MIME-Version: 1.0 Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Moin, On Fri, April 21, 2017 7:04 am, David Rowley wrote: > On 21 April 2017 at 22:30, Tels wrote: >> I'd rather see: >> >> CREATE STATISTICS stats_name ON table(col); >> >> as this both mirrors CREATE INDEX and foreign keys with REFERENCES. It >> could also be extended to both more columns, expressions or other tables >> like so: >> >> CREATE STATISTICS stats ON t1(col1, col2 / 2), t2 (a,b); >> >> and even: >> >> CREATE STATISTICS stats ON t1(col1, col2 / 2), t2 (a,b) WITH (options) >> WHERE t2.a > 4; > > How would you express a join condition with that syntax? > >> This looks easy to remember, since it compares to: >> >> CREATE INDEX idx_name ON t2(a,b) WITH (options) WHERE t2.a > 4; >> >> Or am I'm missing something? > > Sadly yes, you are, and it's not the first time. > > I seem to remember mentioning this to you already in [1]. > > Please, can you read over [2], it mentions exactly what you're > proposing and why it's not any good. > > [1] > https://www.postgresql.org/message-id/CAKJS1f9HMeT+7adicEaU8heOMpOB5pKkCVYZLiEZje3DVutVPw@mail.gmail.com > [2] > https://www.postgresql.org/message-id/CAEZATCUtGR+U5+QTwjHhe9rLG2nguEysHQ5NaqcK=VbJ78VQFA@mail.gmail.com Ah, ok, thank you, somehow I missed your answer the first time. So, just ignore me :) Best wishes, Tels -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers