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 1sARmF-009rZ6-MF for pgsql-bugs@arkaria.postgresql.org; Fri, 24 May 2024 10:03:57 +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 1sARmE-004GCH-PZ for pgsql-bugs@arkaria.postgresql.org; Fri, 24 May 2024 10:03:54 +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 1sARmE-004GC9-Dc for pgsql-bugs@lists.postgresql.org; Fri, 24 May 2024 10:03:54 +0000 Received: from wfhigh3-smtp.messagingengine.com ([64.147.123.154]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sARm9-000WbA-J0 for pgsql-bugs@lists.postgresql.org; Fri, 24 May 2024 10:03:53 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailfhigh.west.internal (Postfix) with ESMTP id 198FC18001A5; Fri, 24 May 2024 06:03:46 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Fri, 24 May 2024 06:03:46 -0400 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-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1716545025; x= 1716631425; bh=F8LeC54/LVrgH7NhMU2PllSvoGlsYsX4KMi/VMzrFl4=; b=h pxxpTmUR8N1ascerdKnBpEGhkPZp5ciQXRAhX8CQ4gg2PxzeyyYsBM0wkiBgrxt1 sd7+0epA9rYJWMejRNAbZlElDtHeWalA9hRgWlqFSI887uaTEgFVL0mvQGWnYSnS Bsm4YmWb9vSaOIF26N5hDS1ymFTkv0TN2wV+jDMul7R0Nody5n8jPozpAHHVWXLz xVd1QQU23FHdCn+53ZMCPbrYIU8k0vpXsMYdMvxwIrQasJMyO3MvuvEZymYYd8bJ za2Cr4kixk9nfT5IEf6HgLPvPXXN1dY2uI6eAKjkUsPqsPBhJuyfVp8NZpf+gKVx 9JcqjtrMmXD3Xb5+WpUQw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdeikedgvdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkgggtugfgjgesthekredttddtjeenucfhrhhomheptehlvhgr rhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh eqnecuggftrfgrthhtvghrnhepvdektdffudfftdffffehfffhjeejhffgieeuueekjeek fffgudffhfduffffueevnecuffhomhgrihhnpegvnhhtvghrphhrihhsvggusgdrtghomh enucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhv hhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhg X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 24 May 2024 06:03:45 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1716545022; bh=Ab+AyDvg2fesKJryoy8xPsLQXU8A3/wt2/BRaaKq4oY=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=GIVNciDGNC4n02LTr7ubHZt4OUvwMkDYQ8Bcrf2JKil8A+Lyf1t48ilpkOogbMTH2 ai9odclLUSc/glsuxtJtZDawW1lNkBWkMMOq5usmwg+XhIg/APrVY7Sciqzl9Yp4Yy SeGtzgMx+q1VY1peId95ADnoF+eMaYyCJeFP0zOW/jJKXx5RF/llyx4F8BwXMnrbTb c++dSp5OZYaQDIz0ol6D7qhc1RJGPxqYklmlCWbAftfmqvjN0RWsZiGkSaNpVrWRFG u+ifg8gQV3n6eGjwc4f1IfcARCxG4Kuc/WjLVexGOYbSAhfPedqeZD3Rj/6RHKJinz PixzNb7wla/pg== Received: by schmee.alvh.no-ip.org (Postfix, from userid 1000) id 40214A7; Fri, 24 May 2024 12:03:42 +0200 (CEST) Date: Fri, 24 May 2024 12:03:42 +0200 From: Alvaro Herrera To: Alexander Alexander Cc: Tom Lane , pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18477: A specific SQL query with "ORDER BY ... NULLS FIRST" is performing poorly if an ordering column is n Message-ID: <202405241003.uxtpwvtwcods@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 On 2024-May-24, Alexander Alexander wrote: > Additionally, as you mentioned, the default index is created with NULLS > LAST, but in this case, the column is non-nullable, making NULLS LAST > unnecessary as well. But the NOT NULL constraint could be dropped at any minute, so the system needs to know where NULLs would go if that were to happen. -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/ "Los dioses no protegen a los insensatos. Éstos reciben protección de otros insensatos mejor dotados" (Luis Wu, Mundo Anillo)