Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fVoeo-0005tf-0K for pgsql-bugs@arkaria.postgresql.org; Thu, 21 Jun 2018 01:45:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fVoel-0002Jx-AZ for pgsql-bugs@arkaria.postgresql.org; Thu, 21 Jun 2018 01:45:03 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fVoel-0002Jp-1P for pgsql-bugs@lists.postgresql.org; Thu, 21 Jun 2018 01:45:03 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fVoei-00008S-Cd for pgsql-bugs@lists.postgresql.org; Thu, 21 Jun 2018 01:45:01 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w5L1ivGZ012274; Wed, 20 Jun 2018 21:44:57 -0400 From: Tom Lane To: sara.pranke@gmail.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #15250: ERROR: could not find pathkey item to sort In-reply-to: <152952849928.1252.6596277019511618168@wrigleys.postgresql.org> References: <152952849928.1252.6596277019511618168@wrigleys.postgresql.org> Comments: In-reply-to =?utf-8?q?PG_Bug_reporting_form?= message dated "Wed, 20 Jun 2018 21:01:39 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <12272.1529545496.1@sss.pgh.pa.us> Date: Wed, 20 Jun 2018 21:44:56 -0400 Message-ID: <12273.1529545496@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk =?utf-8?q?PG_Bug_reporting_form?= writes: > I have complex queries in large tables that use memory for sorting items, we > upgrate PostgreSQL from 9.1 to 9.4 and in this version we get this error: > 'could not find pathkey item to sort' That's a fairly common visible symptom for erroneous construction of a plan inside the planner. It has nothing directly to do with memory consumption, although it's possible that changing work_mem would encourage the planner to choose a different plan shape that avoids the bug. Another likely explanation for the problem appearing and disappearing is that it could be sensitive to the current statistics for the table(s) the query is on, in which case a background auto-analyze might be enough to flip you from the plan shape with the problem to the plan shape without. Anyway, we'd certainly be interested to fix the problem if you can provide a self-contained, reproducible test case. I'd suggest trying to generate some dummy data that the query fails on. regards, tom lane