[Engine-devel] Opimizing Postgres Stored Procedures
Laszlo Hornyak
lhornyak at redhat.com
Wed Aug 28 11:02:18 UTC 2013
----- Original Message -----
> From: "Eli Mesika" <emesika at redhat.com>
> To: "Laszlo Hornyak" <lhornyak at redhat.com>
> Cc: "engine-devel" <engine-devel at ovirt.org>
> Sent: Wednesday, August 28, 2013 11:45:14 AM
> Subject: Re: [Engine-devel] Opimizing Postgres Stored Procedures
>
>
>
> ----- Original Message -----
> > From: "Laszlo Hornyak" <lhornyak at redhat.com>
> > To: "Eli Mesika" <emesika at redhat.com>
> > Cc: "engine-devel" <engine-devel at ovirt.org>
> > Sent: Tuesday, August 27, 2013 11:40:27 AM
> > Subject: Re: [Engine-devel] Opimizing Postgres Stored Procedures
> >
> > Hi Eli,
> >
> > Most of the functions that we have in the DB are doing very simple jobs
> > like
> > run a query, insert/update and I see that now you have all QUERY functions
> > as STABLE.
> > My questions:
> > Is this required for new functions from now on?
> Yes and a email asking that was posted to engine_devel
>
> > Is this done in order to improve performance?
> Yes
Do you have any documents/benchmarks on how and why does this improve performance?
STABLE functions should improve performance if they return the same result for the same parameters in the same statement.
E.g. if you have a stable function like "select foo(x) from y" then the function can be invoked only once to evaluate each distinct value of y.x - this is kind of useful
Functions running queries for the ovirt engine are typically invoked from client side, therefore they are only ivoked once from the parameters list and therefore will be only executed once for that single statement.
>
> >
> > Thank you,
> > Laszlo
> >
> > ----- Original Message -----
> > > From: "Eli Mesika" <emesika at redhat.com>
> > > To: "engine-devel" <engine-devel at ovirt.org>
> > > Sent: Monday, August 26, 2013 11:22:20 AM
> > > Subject: [Engine-devel] Opimizing Postgres Stored Procedures
> > >
> > > Hi
> > >
> > > I had merged the following patch
> > > http://gerrit.ovirt.org/#/c/17962/
> > >
> > > This patch introduce usage of the IMMUTABLE, STABLE and STRICT keywords
> > > in
> > > order to boost performance of the Postgres SPs.
> > >
> > > Please make sure that your current/and future DB scripts applied that.
> > >
> > >
> > > Volatility
> > > ----------
> > > * A function should be marked as IMMUTABLE if it doesn't change the
> > > database,
> > > and if it doesn't perform any lookups (even for database configuration
> > > values) during its operation.
> > > * A function should be marked STABLE if it doesn't change the database,
> > > but
> > > might perform lookups (IMMUTABLE is preferable if function meets the
> > > requirements).
> > > * A function doesn't need to be marked VOLATILE, because that's the
> > > default.
> > >
> > > STRICTNESS
> > > ----------
> > > A function should be marked STRICT if it should return NULL when it is
> > > passed
> > > a NULL argument, and then the function won't even be called if it is
> > > indeed
> > > passed a NULL argument.
> > >
> > >
> > > I am available for any questions.
> > >
> > > Thanks
> > >
> > > Eli
> > > _______________________________________________
> > > Engine-devel mailing list
> > > Engine-devel at ovirt.org
> > > http://lists.ovirt.org/mailman/listinfo/engine-devel
> > >
> >
>
More information about the Engine-devel
mailing list