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 1qtDGl-00BNY8-HJ for pgsql-performance@arkaria.postgresql.org; Wed, 18 Oct 2023 20:35:55 +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 1qtDGj-008qSB-D3 for pgsql-performance@arkaria.postgresql.org; Wed, 18 Oct 2023 20:35:54 +0000 Received: from makus.postgresql.org ([72.32.157.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 1qtDGj-008qRr-2x for pgsql-performance@lists.postgresql.org; Wed, 18 Oct 2023 20:35:53 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qtDGh-00198J-7J for pgsql-performance@postgresql.org; Wed, 18 Oct 2023 20:35:52 +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 39IKZofc3153247; Wed, 18 Oct 2023 16:35:50 -0400 From: Tom Lane To: Alexander Okulovich cc: pgsql-performance@postgresql.org Subject: Re: Postgres 15 SELECT query doesn't use index under RLS In-reply-to: References: <5c1179bb-240b-4c1c-b4b3-2a24868e44bc@stiltsoft.com> <1570249.1697228785@sss.pgh.pa.us> Comments: In-reply-to Alexander Okulovich message dated "Wed, 18 Oct 2023 16:07:38 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3153245.1697661350.1@sss.pgh.pa.us> Date: Wed, 18 Oct 2023 16:35:50 -0400 Message-ID: <3153246.1697661350@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Alexander Okulovich writes: > We used the product with the default settings. The requests are simple. > We didn't change the hardware (actually, we use even more performant > hardware because of that issue) and DDL. I've checked the request on old > and new databases. Requests that rely on this index execute more than 10 > times longer. Planner indeed used Index Scan before, but now it doesn't. > So, from my perspective, the only reason we experience that is database > logic change. [ shrug... ] Maybe, but it's still not clear if it's a bug, or an intentional change, or just a cost estimate that was on the hairy edge before and your luck ran out. If you could provide a self-contained test case that performs 10x worse under v15 than v12, we'd surely take a look at it. But with the information you've given so far, little is possible beyond speculation. regards, tom lane