Re: Postgres 15 SELECT query doesn't use index under RLS

Alexander Okulovich <aokulovich@stiltsoft.com>

From: Alexander Okulovich <aokulovich@stiltsoft.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-performance@postgresql.org
Date: 2023-10-26T13:47:03Z
Lists: 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.