回复: [External] Re: PG 10 experience different user execute same sql get different access plan

From: Zhiyu ZY13 Xu <xuzy13(at)lenovo(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: 回复: [External] Re: PG 10 experience different user execute same sql get different access plan
Date: 2021-05-19 16:05:30
Message-ID: HK2PR03MB4610A614CC066BAF760B8CE2A82B9@HK2PR03MB4610.apcprd03.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Tom

Thanks for your quick response. I check the table ddl. There is no row-level security turn on.

There are 2 tables.
dcg.brick_base_ebr This table is partition table. And have trigger define on the table.
dcg.brick_shipment This is very simple and normal table.

I attach the table ddl for your reference.

I also attach the output about different user get different access plan for your reference.


徐志宇(Jack)
Database Engineer
    
DB Team,ITS. Lenovo China
Phone: 86-18910860709
Email:xuzy13(at)lenovo(dot)com
No.6 Shangdi West Road, Haidian District Beijing, China, 100085

-----邮件原件-----
发件人: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
发送时间: 2021年5月19日 23:00
收件人: Zhiyu ZY13 Xu <xuzy13(at)lenovo(dot)com>
抄送: pgsql-general(at)lists(dot)postgresql(dot)org
主题: [External] Re: PG 10 experience different user execute same sql get different access plan

Zhiyu ZY13 Xu <xuzy13(at)lenovo(dot)com> writes:
> I experience a PG optimizer problem. Different user query with same SQL at same time. But get different access plan.

If you've got row-level security turned on for that table, it could explain results like this. RLS limits the planner's ability to see statistics, which can easily result in a worse plan.

regards, tom lane

Attachment Content-Type Size
psql_ds_result.txt text/plain 18.3 KB
Table_ddl.txt text/plain 17.5 KB
Access_plan.txt text/plain 8.7 KB

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David Steele 2021-05-19 17:08:24 Re: pgbackrest info of encrypted seems broken
Previous Message Tom Lane 2021-05-19 15:00:18 Re: PG 10 experience different user execute same sql get different access plan