User Tools

Site Tools


scratchpad:random_magic_spells

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

scratchpad:random_magic_spells [2017/03/16 09:11] rjs7scratchpad:random_magic_spells [2022/02/10 13:34] (current) – external edit 127.0.0.1
Line 228: Line 228:
 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); JSAN.use('util.file'); var f = new util.file('ws_info'); alert(f._file.path); netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); JSAN.use('util.file'); var f = new util.file('ws_info'); alert(f._file.path);
 </code> </code>
 +
 +====== Performance ======
 +=====Preload Your database into RAM=====
 +Find your database's oid and make a note of it:
 +<code>
 +psql -U evergreen -h localhost -d postgres -c "select oid from pg_database where datname = 'evergreen'"
 +</code>
 +
 +Then, as the root or postgres user, run the following commands
 +<code>
 +cd /var/lib/postgresql/${pgversion}/main/base/${oid}
 +cat * > /dev/null
 +</code>
 +
 +Replace ${pgversion} with your PostgreSQL version number, ex. 9.5.  Replace ${oid} with the number returned by the database query.
  
 ====== Utility ====== ====== Utility ======
Line 539: Line 554:
 ; ;
 </code> </code>
 +
 +
 +=====Show statistic usage on reports===
 +
 +<code sql>
 +select thecount.name,create_time,thecount.lasttime,thecount.count from
 +reporter.template rt,
 +(
 +select rtinner.name "name",max(run_time) "lasttime",count(*) "count" from reporter.schedule rs,reporter.report rr,
 +(select naming.name,string_agg(clones.id||'',',') ids from
 +reporter.template naming ,
 +reporter.template clones
 +where
 +clones.data=naming.data and
 +naming.folder in(select id from reporter.template_folder where owner= !!!REPLACE ME WITH OWNER ID!!! and shared and share_with=1) and
 +naming.owner=  !!!REPLACE ME WITH OWNER ID!!!
 +group by 1
 +) rtinner
 +
 +where rr.template = any(('{'||rtinner.ids||'}')::int[]) and rr.id=rs.report
 +group by 1
 +
 +) as thecount
 +where
 +thecount.name = rt.name and
 +rt.owner=  !!!REPLACE ME WITH OWNER ID!!!  and
 +rt.folder in(select id from reporter.template_folder where owner= !!!REPLACE ME WITH OWNER ID!!! and shared and share_with=1)
 +order by 4 desc
 +
 +</code>
 +
 +You will need to edit that query to look for reports owned by a particular actor.usr.id. Replace "!!!REPLACE ME WITH OWNER ID!!!" with the ID number. This is useful when you have centralized report templates for everyone to use. It also takes into account cloned reports from the same source template!
  
 ====== Development ====== ====== Development ======
scratchpad/random_magic_spells.1489669917.txt.gz · Last modified: 2022/02/10 13:33 (external edit)

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki

© 2008-2022 GPLS and others. Evergreen is open source software, freely licensed under GNU GPLv2 or later.
The Evergreen Project is a U.S. 501(c)3 non-profit organization.