From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | jian he <jian(dot)universality(at)gmail(dot)com> |
Cc: | Dmitry Dolgov <9erthalion6(at)gmail(dot)com>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, Erik Rijkers <er(at)xs4all(dot)nl>, Michael Paquier <michael(at)paquier(dot)xyz>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, DUVAL REMI <REMI(dot)DUVAL(at)cheops(dot)fr>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Re: proposal: schema variables |
Date: | 2025-01-06 19:10:12 |
Message-ID: | CAFj8pRD67R73TcbN9sShbKLdtoLGRsM8GJVC_OqY=EWe3sJ1xw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-performance |
Hi
>
>>
>> we use PlannerGlobal
>> {
>> Oid basenodeSessionVarid;
>> Bitmapset *checkSelectPermVarids;
>> }
>> to solve the self-assigned corner case SELECT privilege.
>> (let v1.a =v1.a; in this case, we need have SELECT priv for v1.a
>> but let v1.a = 1, we don't need SELECT priv for v1.a).
>>
>> i found out these two field value(information) most case is the same
>> as PlannerGlobal.sessionVariables;
>> I came up with another solution, introduce a bool
>> (Query.is_Variable_assigned),
>> and get rid of PlannerGlobal.basenodeSessionVarid,
>> PlannerGlobal.checkSelectPermVarids.
>> not sure it make sense to you, refer
>> v1-0002-refactoring-LET-statement-self-assign-privileg.no-cfbot
>>
>
> It is true, so bitmapset checkSelectPermVarids contains almost all the
> same data like sessionVariables.
> But checkSelectPermVarids allows fast checking if a variable is used
> already, and sessionVariables list ensures necessary order.
>
> My implementation needs more memory (one bitmapset), but I think it is
> very simple and less error prone (doesn't depend on iteration order).
>
> In this case and this moment I prefer my bitmapset based solution. It can
> be optimized maybe later - I thought about a dedicated item in
> sessionVariables for the basenode parameter.
> This should be a clear winner for value passed types, but for varlena
> types (for long varlena types), it can force passing content of some
> session variable twice.
>
I found so storing oid to bitmapset can have big memory overhead. Bitmapset
with one oid value like 16000 has about 2kB. So instead storing varid, I
try to store paramid. paramid starts by zero.
See patch 03. Now the overhead of the usage of bitmapset for calculation of
the variable excluded from SELECT acl check has tens bytes overhead.
Regards
Pavel
>
> Regards
>
> Pavel
>
>
>
>
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Matthias van de Meent | 2025-01-06 19:13:43 | Re: Parallel CREATE INDEX for GIN indexes |
Previous Message | Noah Misch | 2025-01-06 19:04:28 | Re: Converting contrib SQL functions to new style |
From | Date | Subject | |
---|---|---|---|
Next Message | Slava Mudry | 2025-01-06 23:18:28 | Re: Aggressive vacuum |
Previous Message | Pavel Stehule | 2025-01-06 12:21:09 | Re: Re: proposal: schema variables |