pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alexander Okulovich <aokulovich@stiltsoft.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Postgres 15 SELECT query doesn't use index under RLS
Date: Thu, 26 Oct 2023 10:09:37 -0400
Message-ID: <1157086.1698329377@sss.pgh.pa.us> (raw)
In-Reply-To: <e9d503cb-efeb-43d3-952e-f517e4d24302@stiltsoft.com>
References: <5c1179bb-240b-4c1c-b4b3-2a24868e44bc@stiltsoft.com>
	<1570249.1697228785@sss.pgh.pa.us>
	<dd874d42-ad02-48a6-82db-5666f1ee0ec1@stiltsoft.com>
	<3153246.1697661350@sss.pgh.pa.us>
	<e9d503cb-efeb-43d3-952e-f517e4d24302@stiltsoft.com>

Alexander Okulovich <aokulovich@stiltsoft.com> writes:
> I've attempted to reproduce this on my PC in Docker from the stage 
> database dump, but no luck. The first query execution on Postgres 15 
> behaves like on the real stage, but subsequent ones use the index.

Can you force it in either direction with "set enable_seqscan = off"
(resp. "set enable_indexscan = off")?  If so, how do the estimated
costs compare for the two plan shapes?

> Also, 
> they execute much faster. Looks like the hardware and(or) the data 
> structure on disk matters.

Maybe your prod installation has a bloated index, and that's driving
up the estimated cost enough to steer the planner away from it.

			regards, tom lane





view thread (10+ messages)  latest in thread

Message-ID: <1157086.1698329377@sss.pgh.pa.us>
Permalink:  ../1157086.1698329377@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1157086.1698329377@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, aokulovich@stiltsoft.com
  Subject: Re: Postgres 15 SELECT query doesn't use index under RLS
  In-Reply-To: <1157086.1698329377@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox