Ad Widget

Collapse

Calculated Items or Triggers with arithmetical expressions operations ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Razique
    Junior Member
    • Sep 2009
    • 19

    #1

    Calculated Items or Triggers with arithmetical expressions operations ?

    Hi all
    I just started to use the calculated items, it's awesome

    I've now a question, I've like 20 triggers that calculate items, eg :
    ({Template_App_MySQL:mysql.status.Qcache_free_bloc ks.last(0)}=0/{Template_App_MySQL:mysql.status.Qcache_total_bloc ks.last(0)}=0)>0.35

    My question is : should I use a calculated item, let's say :
    %age of free blocks : Qcache/Total, and a trigger, if %age of free blocks > 35 %

    Or should I keep simple items and make the calculation into the triggers ?
    best regards,
    Razique
  • Ori0n
    Member
    • Dec 2010
    • 35

    #2
    I think we need more details. Are you performing the *same* calculation 20 times and evaluating the result? If so, the best thing for CPU load (at the expense of DB space) would be to store the calculated value and then use that item in the trigger expression. If the calculation changes each time *and* you have no real use for the calculation result for trending, then just perform the calculation in the trigger expression.

    Comment

    • Razique
      Junior Member
      • Sep 2009
      • 19

      #3
      Hi, thanks for your answer.
      What I meant is in order to get a consolidated value, let's say a percentage for an event (innodb memory usage), I evaluate the different items into the trigger directly
      (if innodb_free/innodb_max > 0.35)

      With the calculated items, that calculation wouldn't be located anymore into trigger, the calculation would the the calculated itsef that I will evalute :
      (if innodb_percent > 0.35)

      So i "move" the calculation from the trigger to the calculated item. My question was "Is there a good practice about that ?"
      Best Regards,
      Razique

      Comment

      Working...