English (Español a continuación)
I.- Introduction
Intelligent calculation allows Essbase to calculate, within the specified area, only those blocks that need to be recalculated:
- Calculate the modified blocks and their ancestors.
- It does NOT calculate those blocks whose data has not been modified.
- It has a very significant impact on efficiency.
For intelligent calculation purposes, blocks can have two marks:
- “Clean”: the block is up to date (it does not need to be calculated).
- “Dirty”: the block has been modified (it does need to be calculated).
- If a block is marked as “Dirty” all its ancestors receive this mark.
A block is marked as «Clean»:
- After executing a CALC ALL.
- After running a CALC DIM that includes all dimensions.
A block is marked «Dirty»:
- If the block has been calculated within a partial database calculation (for example, a CALC DIM that does not include all dimensions).
- When data is uploaded to the block.
- When the base is restructured (inclusion of a member of a dense dimension).
- When data is copied into the block (for example, with the DATACOPY command).
By default, intelligent calculation is activated. To change this status:
- You can modify the status of UPDATECALC in the configuration file “essbase.cfg”.
- You can also change the status (activate or deactivate) in a calculation script using the command “SET UPDATECALC ON / OFF;”. It can be alternated throughout the calculation script.
II.- Advantages / disadvantages of intelligent calculation
Advantage:
- Significant time savings, especially if a full database calculation (CALC ALL) is launched and a large percentage of the blocks remain unchanged.
- On the contrary, if a high percentage of the database has been modified and needs to be recalculated then it may not be interesting to activate the intelligent calculation (Essbase has to verify the status of the “Clean” / “Dirty” blocks which entails an increase in calculation time between 5-10% which may be greater than the benefit).
- It is very useful when partial data uploads are performed repeatedly and the database needs to be recalculated each time; the intelligent calculation allows a significant saving of time calculating exclusively those blocks that have been modified.
Disadvantages:
- It requires a very rigorous control of the “Clean” / “Dirty” status of the blocks. It is necessary to avoid that a block is marked as “Clean” when it needs to be calculated (it can generate incomplete / inconsistent calculations of the database).
- It is not recommended when there may be concurrent calculations on the database: the first calculation may mark the block as “Clean” and the other calculations may not act on that block.
- When a CALC ALL needs to perform two passes on the database, the blocks calculated in the first pass are marked “Clean” so they are not calculated in the second pass (the alternative may be to use several CALC DIMs instead of the CALC ALL so the blocks do not receive the “Clean” mark).
III.- Control of the mark “Clean” / “Dirty”
If intelligent calculation is activated but the CALC ALL or CALC DIM commands (with all dimensions) are not used in the calculation script, the blocks do not receive the “Clean” mark, so you do not benefit from the advantages of intelligent calculation. For this, it may be interesting to control the status of the blocks so that those that have already been calculated, and do not need to be calculated again, receive the “Clean” mark (which Essbase has not assigned by default).
For this we can use the command «SET CLEARUPDATESTATUS». This command has three options:
a) «SET CLEARUPDATESTATUS AFTER;» assigns the “Clean” mark to the calculated blocks that by default Essbase would leave marked as “Dirty”.
- For example, after a partial calculation of the database if we want them to be marked “Clean” (Essbase by default would leave them the mark “Dirty”).
- Should not be used if there may be concurrent calculations (unless we know they affect different sections of the database).
- When it is included in the calculation script it affects thereafter; it is deactivated with “SET CLEARUPDATESTATUS OFF;”.
For example:
- SET CLEARUPDATESTATUS AFTER;
- FIX («Year 2020», Germany, «Product A»)
- CALC DIM (Sellers);
- ENDFIX
b) «SET CLEARUPDATESTATUS ONLY;» mark the selected blocks «Clean» but without performing any calculation.
For example:
- SET CLEARUPDATESTATUS ONLY;
- FIX («Year 2020», Germany, «Product A»)
- CALC DIM (Sellers);
- ENDFIX
It does not perform the calculation but the blocks that would be affected by it receive the “Clean” mark.
For example, it may be interesting if we carry out various partial calculations (the blocks are marked “Dirty”), but we want all the blocks to be marked “Clean” at the end of the calculation: we will include as the last instruction in the calculation script:
- SET CLEARUPDATESTATUS ONLY;
- CALC ALL;
The calculation is not executed but all blocks are marked “Clean”.
c) «SET CLEARUPDATESTATUS OFF;» After the calculation Essbase keeps the initial mark of the blocks (“Clean” / “Dirty”).
IV.- Difficulties of applying it in a calculation script
Applying an intelligent calculation is a calculation script can be a source of problems; it is very difficult to control precisely the “Clean” / “Dirty” mark of all the blocks affected by the calculation.
- IF the script uses the CALC ALL or CALC DIM (all dimensions) commands at some point and the intelligent calculation is activated, all the blocks receive the “Clean” mark, so from then on some of the calculations may not be carried out (resulting in incomplete / inconsistent calculation).
- Apply the commands «SET CLEARUPDATESTATUS;» To control the “Clean” / Dirty ”mark throughout the calculation script can be very complex (unless it is a simple script).
- Therefore, as a general rule, intelligent calculation should be disabled in a calculation script.
- The command «SET UPDATECALC OFF;» must be included at the beginning of the script; (since by default Essbase has intelligent calculation activated).
V.- Other observations
- When using the CLEARDATA or CLARBLOCK command Essbase acts on all blocks, regardless of whether intelligent calculation is activated or not.
Español
I.- Introducción
El cálculo inteligente permite a Essbase calcular, dentro del área especificada, únicamente aquellos bloques que necesitan ser recalculados:
- Calcula los bloques modificados y sus ascendientes.
- NO calcula aquellos bloques cuyos datos no se han modificado.
- Tiene un impacto muy significativo en eficiencia.
A efectos del cálculo inteligente, los bloques pueden tener dos marcas:
- “Clean”: el bloque está actualizado (no necesita ser calculado).
- “Dirty”: el bloque se ha modificado (sí necesita ser calculado).
- Si un bloque es marcado como “Dirty” todos sus ascendientes reciben esta marca.
Un bloque es marcado como “Clean”:
- Tras ejecutar un CALC ALL.
- Tras ejecutar un CALC DIM que incluya todas las dimensiones.
Un bloque es marcado como “Dirty”:
- Si el bloque se ha calculado dentro de un cálculo parcial de la base de datos (por ejemplo, un CALC DIM que no incluya todas las dimensiones).
- Cuando se suben datos al bloque.
- Cuando se reestructura la base (inclusión de un miembro de una dimensión densa).
- Cuando se copian datos en el bloque (por ejemplo, con el comando DATACOPY).
Por defecto el cálculo inteligente está activado. Para cambiar este estatus:
- Se puede modificar el estatus de UPDATECALC en el fichero de configuración “essbase.cfg”.
- También se puede modificar el estatus (activar o desactivar) en un script de cálculo mediante el comando “SET UPDATECALC ON / OFF;”. Se puede ir alternando a lo largo del script de cálculo.
II.- Ventajas / desventajas del cálculo inteligente
Ventajas:
- Significativo ahorro de tiempo, especialmente si se lanza un cálculo completo de la base de datos (CALC ALL) y un gran porcentaje de los bloques no se ha modificado.
- Por el contrario, si un porcentaje elevado de la base de datos se ha modificado y necesita ser recalculado entonces puede no interesar activar el cálculo inteligente (Essbase tiene que verificar el estatus de los bloques “Clean” / “Dirty” lo que conlleva un incremento del tiempo de cálculo entre un 5-10% que puede ser mayor que el beneficio).
- Es muy útil cuando se realizan subidas parciales de datos de forma repetitiva y la base necesita ser recalculada en cada ocasión; el cálculo inteligente permite un significativo ahorro de tiempo calculando exclusivamente aquellos bloques que se han modificado.
Desventajas:
- Exige un control muy riguroso del estatus “Clean” / “Dirty” de los bloques. Hay que evitar que un bloque quede marcado como “Clean” cuando necesita ser calculado (puede generar cálculos incompletos / incoherentes de la base de datos).
- No es recomendable cuando puede haber cálculos concurrentes sobre la base de datos: puede que el primer cálculo marque el bloque como “Clean” y que los demás cálculos no actúen sobre este bloque.
- Cuando un CALC ALL necesita realizar dos pasadas sobre la base, los bloques calculados en la primera pasada son marcados “Clean” por lo que no se calculan en la segunda pasada (la alternativa puede ser utilizar varios CALC DIM en lugar del CALC ALL para que el bloque no reciba la marca “Clean”).
III.- Control de la marca de los bloques “Clean” / “Dirty”
Si el cálculo inteligente está activado pero en el script de cálculo no se utilizan los comandos CALC ALL o CALC DIM (con todas las dimensiones) los bloques no reciben la marca “Clean” por lo que no se beneficia de las ventajas del cálculo inteligente. Para ello puede interesar controlar el estatus de los bloques para que aquellos que ya han sido calculados, y no necesitan volver a ser calculados, reciban la marca “Clean” (que Essbase no ha asignado por defecto).
Para esto podemos utilizar el comando “SET CLEARUPDATESTATUS”. Este comando tiene tres opciones:
a) “SET CLEARUPDATESTATUS AFTER;” asigna la marca “Clean” a los bloques calculados a los que por defecto Essbase dejaría marcados como “Dirty”.
- Por ejemplo, tras un cálculo parcial de la base de datos si queremos que queden marcados “Clean” (Essbase por defecto les dejaría la marca “Dirty”).
- No se debe utilizar si puede haber cálculos concurrentes (salvo que sepamos que afectan a secciones diferentes de la base de datos).
- Cuando se incluye en el script de cálculo afecta de ahí en adelante; se desactiva con SET CLEARUPDATESTATUS OFF;
Por ejemplo:
- SET CLEARUPDATESTATUS AFTER;
- FIX(“Año 2020”, Alemania,”Producto A”)
- CALC DIM(Vendedores);
- ENDFIX
b) “SET CLEARUPDATESTATUS ONLY;” marca los bloques seleccionados “Clean” pero sin realizar ningún cálculo.
Por ejemplo:
- SET CLEARUPDATESTATUS ONLY;
- FIX(“Año 2020”, Alemania,”Producto A”)
- CALC DIM(Vendedores);
- ENDFIX
No realiza el cálculo pero los bloques que se verían afectados por el mismo reciben la marca “Clean”.
Por ejemplo, puede interesar si vamos realizando diversos cálculos parciales (los bloques reciben la marca “Dirty”), pero queremos que al final del cálculo todos los bloques queden con la marca “Clean”: incluiremos como última instrucción del script de cálculo:
- SET CLEARUPDATESTATUS ONLY;
- CALC ALL;
El cálculo no se ejecuta pero todos los bloques reciben la marca “Clean”.
c) “SET CLEARUPDATESTATUS OFF;” Essbase mantiene tras el cálculo la marca inicial de los bloques (“Clean” / “Dirty”).
IV.- Dificultades de aplicarlo en un script de cálculo
Aplicar un cálculo inteligente es un scritp de cálculo puede ser una fuente de problemas; es muy complicado controlar con precisión la marca “Clean” / “Dirty” de todos los bloques afectados por el cálculo.
- SI el script utiliza en algún momento los comandos CALC ALL o CALC DIM (todas las dimensiones) y el cálculo inteligente está activado todos los bloques reciben la marca “Clean” por lo que de ahí en adelante algunos de los cálculos puede que no se ejecuten (resultando un cálculo incompleto / incoherente).
- Aplicar los comandos “SET CLEARUPDATESTATUS;” para controlar la marca “Clean” / Dirty” a lo largo del script de cálculo puede resultar muy complejo (salvo que se trate de un script sencillo).
- Por todo ello, por regla general el cálculo inteligente se debe desactivar en un script de cálculo.
- Se debe incluir al comienzo del script el comando “SET UPDATECALC OFF;” (ya que por defecto Essbase tiene activado el cálculo inteligente).
V.- Otras observaciones
- Cuando se utiliza el comando CLEARDATA o CLARBLOCK Essbase actúa sobre todos los bloques, con independencia de que el cálculo inteligente esté activado o no.