Re: Cómo cambio el plan de ejecución de un query

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>
Cc: Carlos Beltrán V(dot) <cbeltran(at)roldan(dot)net>, ListaPostgreSQL <pgsql-es-ayuda(at)postgresql(dot)org>
Subject: Re: Cómo cambio el plan de ejecución de un query
Date: 2008-09-02 23:30:47
Message-ID: 20080902233047.GS12610@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

Alvaro Herrera escribió:

> Hasta antes de 8.3, sólo se hacía inlining de funciones muy simples
> (creo que ni siquiera podían tener cláusulas FROM). En 8.3 se introdujo
> tecnología un poquito mejor, pero de todas formas la cantidad de
> funciones que se pueden mezclar es muy pequeña.

Me equivoqué ... en CVS HEAD (8.4devel) sigue siendo sólo posible hacer
inlining the funciones que son del tipo "SELECT expresión" y nada más.

/*
* inline_function: try to expand a function call inline
*
* If the function is a sufficiently simple SQL-language function
* (just "SELECT expression"), then we can inline it and avoid the rather
* high per-call overhead of SQL functions. Furthermore, this can expose
* opportunities for constant-folding within the function expression.
*
* We have to beware of some special cases however. A directly or
* indirectly recursive function would cause us to recurse forever,
* so we keep track of which functions we are already expanding and
* do not re-expand them. Also, if a parameter is used more than once
* in the SQL-function body, we require it not to contain any volatile
* functions (volatiles might deliver inconsistent answers) nor to be
* unreasonably expensive to evaluate. The expensiveness check not only
* prevents us from doing multiple evaluations of an expensive parameter
* at runtime, but is a safety value to limit growth of an expression due
* to repeated inlining.
*
* We must also beware of changing the volatility or strictness status of
* functions by inlining them.
*
* Returns a simplified expression if successful, or NULL if cannot
* simplify the function.
*/

--
Alvaro Herrera Developer, http://www.PostgreSQL.org/
"Puedes vivir solo una vez, pero si lo haces bien, una vez es suficiente"

In response to

Responses

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Lennin Caro 2008-09-02 23:32:12 Re: PostgreSQL Spanish Documentation Project
Previous Message Jaime Casanova 2008-09-02 23:30:24 Re: default current_time