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 1r5t3r-00Fh3t-1p for pgsql-hackers@arkaria.postgresql.org; Wed, 22 Nov 2023 19:38:59 +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 1r5t3p-00CERT-2J for pgsql-hackers@arkaria.postgresql.org; Wed, 22 Nov 2023 19:38:57 +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 1r5t3n-00CER3-5z for pgsql-hackers@lists.postgresql.org; Wed, 22 Nov 2023 19:38:56 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r5t3j-006r5g-Uz for pgsql-hackers@postgresql.org; Wed, 22 Nov 2023 19:38:53 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id C03725C0231; Wed, 22 Nov 2023 14:38:50 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Wed, 22 Nov 2023 14:38:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm1; t=1700681930; x=1700768330; bh=Sd d0NGAgRa73CFpfYBDDG+aIvNTS/UNI0o0yOX/AXUQ=; b=uh/WYBTX2C+5ltyGbZ FT5ApiOfkqGI0jp+SoCzz9N/UC3r/6Go4/K9BNmM5cs2mD9HbPJ3w9sIuNFvEy3+ AHCsUCJggQ5/KSM3fJYUKL1nMo6xy8vn+gsU36ZoTdo1wYSaHHdxAw8WHFKOGDKl qJNpYkByL5xUaPO94+EiQSD/IHXw/xjnQnM3P5vdH557G0rAk/I0Tj+v4xq1828J lRfJRhWPkui0GuURXIQHDAsnXrkZlkEmCQHylF6LkQ0uMp4GdFchevEQg0wY8fzc yHQ0wv4UhLMEoJe1CRVMztNXbKgGQfXiR9LZAs4+x2+0L5OyxyNO4eJHvLKtq25q S1Ow== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1700681930; x=1700768330; bh=Sdd0NGAgRa73C FpfYBDDG+aIvNTS/UNI0o0yOX/AXUQ=; b=HFCztrV83uhN3VNViwZ9LaW0lwRTx awFOmNkwwCbbyp5qaw/OBgHBAyX7YkpByDLLEDzGgQODLxNO4veQ/5WaWippfzqV XtJzDID+gxbbVLY/9meqHQD2Ywst/vkcQ34BNJI5IJYEOGRTZsivWXEXMeVhhGd9 bskkCC0WNDbI1jEj5LlWed9YUgmIFO0qMO+injdcyBX3mJdobwmIiz6gSnmFIrvD bC3SkQQszZJOv5BVFPk/Qq6BK4Z/F5yQ1IpZUxc0HOttY4E4hhDVlJXmIb7qqGax JMdhluV1OwXZ+6t/Jyta/HLOLWv5L+NMupfZoK5dIm1rUXPABK5eFkOQg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudehuddguddviecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvvefukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpeetnhgu rhgvshcuhfhrvghunhguuceorghnughrvghssegrnhgrrhgriigvlhdruggvqeenucggtf frrghtthgvrhhnpedvffefvefhteevffegieetfefhtddvffejvefhueetgeeludehteev udeitedtudenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpegrnhgurhgvshesrghnrghrrgiivghlrdguvg X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 22 Nov 2023 14:38:50 -0500 (EST) Date: Wed, 22 Nov 2023 11:38:48 -0800 From: Andres Freund To: Amit Langote Cc: Alvaro Herrera , Andrew Dunstan , jian he , Erik Rijkers , PostgreSQL-development Subject: Re: remaining sql/json patches Message-ID: <20231122193848.vnhi4snatjdgq7uk@awork3.anarazel.de> References: <202309281104.kmkr4v34ny2t@alvherre.pgsql> <20231006214856.yie5dedhzrcb3qxx@alap3.anarazel.de> <20231115171119.svvyzevtfvsqkxpx@awork3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2023-11-21 12:52:35 +0900, Amit Langote wrote: > version gram.o text bytes %change gram.c bytes %change > > 9.6 534010 - 2108984 - > 10 582554 9.09 2258313 7.08 > 11 584596 0.35 2313475 2.44 > 12 590957 1.08 2341564 1.21 > 13 590381 -0.09 2357327 0.67 > 14 600707 1.74 2428841 3.03 > 15 633180 5.40 2495364 2.73 > 16 653464 3.20 2575269 3.20 > 17-sqljson 672800 2.95 2709422 3.97 > > So if we put SQL/JSON (including JSON_TABLE()) into 17, we end up with a gram.o 2.95% larger than v16, which granted is a somewhat larger bump, though also smaller than with some of recent releases. I think it's ok to increase the size if it's necessary increases - but I also think we've been a bit careless at times, and that that has made the parser slower. There's probably also some "infrastructure" work we could do combat some of the growth too. I know I triggered the use of the .c bytes and text size, but it'd probably more sensible to look at the size of the important tables generated by bison. I think the most relevant defines are: #define YYLAST 117115 #define YYNTOKENS 521 #define YYNNTS 707 #define YYNRULES 3300 #define YYNSTATES 6255 #define YYMAXUTOK 758 I think a lot of the reason we end up with such a big "state transition" space is that a single addition to e.g. col_name_keyword or unreserved_keyword increases the state space substantially, because it adds new transitions to so many places. We're in quadratic territory, I think. We might be able to do some lexer hackery to avoid that, but not sure. Greetings, Andres Freund