Re: Postgres 15 SELECT query doesn't use index under RLS - Mailing list pgsql-performance

From Alexander Okulovich
Subject Re: Postgres 15 SELECT query doesn't use index under RLS
Date
Msg-id e9d503cb-efeb-43d3-952e-f517e4d24302@stiltsoft.com
Whole thread Raw
In response to Re: Postgres 15 SELECT query doesn't use index under RLS  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Postgres 15 SELECT query doesn't use index under RLS  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-performance

Hi Tom,

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. Also, they execute much faster. Looks like the hardware and(or) the data structure on disk matters.

Here is the Docker Compose sample config:

version: '2.4'

services:
database-15:  image: postgres:15.4  ports:    - "7300:5432"
  environment:    POSTGRES_DB: stage_db    POSTGRES_USER: stage    POSTGRES_PASSWORD: stage  volumes:    - "./init.sql:/docker-entrypoint-initdb.d/init.sql"
    - "./pgdb/aws-15:/var/lib/postgresql/data"
  mem_limit: 512M  cpus: 2  blkio_config:    device_read_bps:      - path: /dev/nvme0n1        rate: '10mb'
    device_read_iops:        - path: /dev/nvme0n1          rate: 2000    device_write_bps:        - path: /dev/nvme0n1          rate: '10mb'
    device_write_iops:        - path: /dev/nvme0n1          rate: 2000
I performed tests only with CPU and memory limits. If I try to limit the disk(blkio_config), my system hangs on container startup after a while.
Could you please share your thoughts on how to create such a self-contained test case.

Kind regards,

Alexander

On 18.10.2023 22:35, Tom Lane wrote:
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.

pgsql-performance by date:

Previous
From: Jeff Janes
Date:
Subject: Re: GIN JSONB path index is not always used
Next
From: Tom Lane
Date:
Subject: Re: Postgres 15 SELECT query doesn't use index under RLS