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 1tadiN-003j5L-6L for pgsql-hackers@arkaria.postgresql.org; Wed, 22 Jan 2025 16:36:27 +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 1tadiL-001qxw-Na for pgsql-hackers@arkaria.postgresql.org; Wed, 22 Jan 2025 16:36:25 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tadiL-001qxo-Cc for pgsql-hackers@lists.postgresql.org; Wed, 22 Jan 2025 16:36:25 +0000 Received: from fhigh-a1-smtp.messagingengine.com ([103.168.172.152]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tadiI-000w9a-1R for pgsql-hackers@postgresql.org; Wed, 22 Jan 2025 16:36:25 +0000 Received: from phl-compute-09.internal (phl-compute-09.phl.internal [10.202.2.49]) by mailfhigh.phl.internal (Postfix) with ESMTP id BD38C11400BE; Wed, 22 Jan 2025 11:36:21 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-09.internal (MEProxy); Wed, 22 Jan 2025 11:36:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1737563781; x=1737650181; bh=I MvPrf/pIXkRJ4PaGJNuGN47T0Gs0Sgca/iMcXJECxQ=; b=aYEDTaaZ2qzX1zm6i uzl7Oa2JxgkCAuqgFgGAvja19F4Kn86UyX7leylxhxwL53HUMTs4ftpYWhlYO9MI gIrXZTkYm3RQFBHmtJ2mLVjWHzG68sLjlGQOncOBmRay1tfRlOXsT58hZlDCvdCf Fkd4EaigfoVFNTqjMGKj2Er34MPPQWklfL2IXIpc4PaAg44TvrkcJPOJ/d4peQVw M6mt3C/gp7ePZwZvwi7xeiSorS1JQ4JRiVb4SMjFKwcV24sIftOCvwC66MYn1MpO sdlMIU8aoCjdOoNVwuQacVVyJiGUWCDvd4Ltizn+VKc5hEOsRmd/vWecP9MGiX7R CgCOA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudejfedgvdduiecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpeffhffvvefukfggtggugfgjsehtkeertddttdej necuhfhrohhmpeetlhhvrghrohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvh hhrdhnohdqihhprdhorhhgqeenucggtffrrghtthgvrhhnpeeuiefgffeukedtgfetueeu gfetvdeuhefgheelfeehleejleefffejtddtkedvjeenucffohhmrghinhepphhoshhtgh hrrdgvshdpvghnthgvrhhprhhishgvuggsrdgtohhmnecuvehluhhsthgvrhfuihiivgep tdenucfrrghrrghmpehmrghilhhfrhhomheprghlvhhhvghrrhgvsegrlhhvhhdrnhhoqd hiphdrohhrghdpnhgspghrtghpthhtohepvddpmhhouggvpehsmhhtphhouhhtpdhrtghp thhtohepphhgshhqlhdqhhgrtghkvghrshesphhoshhtghhrvghsqhhlrdhorhhgpdhrtg hpthhtoheprghkuhiimhgvnhhkohhvsehtihhmvghstggrlhgvrdgtohhm X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 22 Jan 2025 11:36:21 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1737563779; bh=y7NI4QUK+cKmGtvS50VgLIUTnrLdRQtY9Rwe2EM7WJA=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=Xcrf3GIrXh9AsgOAaNu1EbnJPL8VTIwGlaQ5qXFp0TC5viT/7SRom++Ul1d01Jp9v +5nZh7au93R7TUpeJFR2/Xnu67rhNWEIs00DGkzoqMWhF5r8IIcVCDUBAtPsGt0gzl DX/DomChoLiF7CMtWKNxfCEzo30D98augFTDk4rvDk9w/6wbUr3lcidnksKlIzCSg9 YOCHMDmaor6hkBkmMyAxsrz5ipwnIfrUWyTtU8TbL0GB9QyeSuGLcIdA+zXl+53aA3 SSqvFqcXj+5ZRTqlC8iRq+KGA+GL38sYF8VRxXtXBGFM8Hxos34L+pmCQCXKCbWjxS M9n6iWFn70mUQ== Received: by schmee.alvh.no-ip.org (Postfix, from userid 1000) id 46FC980; Wed, 22 Jan 2025 17:36:19 +0100 (CET) Date: Wed, 22 Jan 2025 17:36:19 +0100 From: Alvaro Herrera To: Alexander Kuzmenkov Cc: pgsql-hackers@postgresql.org Subject: Re: Quadratic planning time for ordered paths over partitioned tables Message-ID: <202501221636.mynlx5r3tba4@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello, On 2025-Jan-22, Alexander Kuzmenkov wrote: > Hi hackers, > > There's currently an unfortunate CPU sink in the planning for > partitioned tables. It happens both for the declarative partitioning, > and for the partitioning through inheritance like we use in > TimescaleDB. > > The gist of it is that there's a linear search of the EM corresponding > to the given child relation in find_ec_member_matching_pathkeys(). I think this is closely related to the work Yuya Watari has been doing at https://postgr.es/m/CAJ2pMkZZHrhgQ5UV0y+STKqx7XVGzENMhL98UbKM-OArvK9dmA@mail.gmail.com Perhaps you could contribute by reviewing that patch series. -- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/ "Los cuentos de hadas no dan al niño su primera idea sobre los monstruos. Lo que le dan es su primera idea de la posible derrota del monstruo." (G. K. Chesterton)