Re: Avoid excessive inlining?

2021-01-02 Thread Pavel Stehule
so 2. 1. 2021 v 21:02 odesílatel Joel Jacobson napsal: > 13.1 > ok there is plpgsql most fast you can check if there are not some hidden implicit casting in your code. Regards Pavel > On Sat, Jan 2, 2021, at 20:37, Pavel Stehule wrote: > > Hi > > so 2. 1. 2021 v 20:07 odesílatel Joel Jacobs

Re: Avoid excessive inlining?

2021-01-02 Thread Joel Jacobson
13.1 On Sat, Jan 2, 2021, at 20:37, Pavel Stehule wrote: > Hi > > so 2. 1. 2021 v 20:07 odesílatel Joel Jacobson napsal: >> __ >> I found yet another trick, which actually seems to be slightly faster than >> the plpgsql version. > > What version of Postgres do you use? > > plpgsql in Postgres

Re: Avoid excessive inlining?

2021-01-02 Thread Pavel Stehule
Hi so 2. 1. 2021 v 20:07 odesílatel Joel Jacobson napsal: > I found yet another trick, which actually seems to be slightly faster than > the plpgsql version. > What version of Postgres do you use? plpgsql in Postgres 13 is significantly faster than on older versions Regards Pavel > The tri

Re: Avoid excessive inlining?

2021-01-02 Thread Joel Jacobson
I found yet another trick, which actually seems to be slightly faster than the plpgsql version. The trick is to use VIEW ... WITH (security_barrier) to tell the optimizer it shouldn’t flatten the subqueries. CREATE TABLE eastern (year integer); INSERT INTO eastern (year) SELECT generate_series

Re: Trigger with conditional predicates

2021-01-02 Thread Adrian Klaver
On 1/2/21 2:23 AM, Dirk Mika wrote: In particular, columns are populated with values if they are not specified in the update statement which is used. Usually with an expression like this: IF NOT UPDATING('IS_CANCELED') THEN :new.is_canceled := ...; END IF; I have not

Re: Restoring 9.1 db from crashed disk/VM

2021-01-02 Thread Magnus Hagander
On Sat, Jan 2, 2021 at 12:50 PM robert wrote: > > Friends > > I hope you had a good start into 2021. > > > I would like to get some advice on how to restore a 9.1 DB, of which I have > the > > /var/lib/postgresql > > with some 20GB salvaged. > > Now I find now easily usable 9.1 PostgreSQL install

Restoring 9.1 db from crashed disk/VM

2021-01-02 Thread robert
Friends I hope you had a good start into 2021. I would like to get some advice on how to restore a 9.1 DB, of which I have the /var/lib/postgresql with some 20GB salvaged. Now I find now easily usable 9.1 PostgreSQL installer anymore. How should I proceed to get that data in a newer PG load

Re: Trigger with conditional predicates

2021-01-02 Thread Alban Hertroys
> On 1 Jan 2021, at 16:56, Dirk Mika wrote: > > Hi all and a happy new Year! > > We have an Oracle schema that is to be converted to PostgreSQL, where > conditional predicates are used in some triggers. > > In particular, columns are populated with values if they are not specified in > the

Re: Trigger with conditional predicates

2021-01-02 Thread Dirk Mika
> > In particular, columns are populated with values if they are not specified > > in the update statement which is used. > > Usually with an expression like this: > > > > IF NOT UPDATING('IS_CANCELED') > > THEN > > :new.is_canceled := ...; > > END IF; > > > > I have not fou

Re: Trigger with conditional predicates

2021-01-02 Thread Dirk Mika
> > PostgreSQL doesn't have an exact equivalent. Typically, the OLD and NEW > > values are compared and then action is taken based on that. For example, > > in PL/pgSQL: > > IF NEW.is_canceled IS NOT DISTINCT FROM OLD.is_canceled THEN > > NEW.is_canceled := etc etc ; > > ENDIF; > > There's cur