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 1mJG6N-0005u6-2M for pgsql-bugs@arkaria.postgresql.org; Thu, 26 Aug 2021 14:11:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mJG6L-0002he-Uv for pgsql-bugs@arkaria.postgresql.org; Thu, 26 Aug 2021 14:11:29 +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 1mJG6L-0002fu-Oc for pgsql-bugs@lists.postgresql.org; Thu, 26 Aug 2021 14:11:29 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mJG6F-0001km-Id for pgsql-bugs@lists.postgresql.org; Thu, 26 Aug 2021 14:11:28 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 17QEBMbE649002; Thu, 26 Aug 2021 10:11:22 -0400 From: Tom Lane To: chetansuttraway@gmail.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17162: order by clause is not pushed down to foreign scans when a WHERE clause is given in query In-reply-to: <17162-d69d57bc36cb53f5@postgresql.org> References: <17162-d69d57bc36cb53f5@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Thu, 26 Aug 2021 05:07:48 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <649000.1629987082.1@sss.pgh.pa.us> Date: Thu, 26 Aug 2021 10:11:22 -0400 Message-ID: <649001.1629987082@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PG Bug reporting form writes: > Wouldn't it be good to push order by clause even when where clause is given > in query? Maybe, but you haven't demonstrated it. In the example you show, the query plan still requires a local sort, so pre-sorting the individual inputs to that would just add cycles without accomplishing anything. In any case, this is not a bug. regards, tom lane