Bug #2068
closedSome queries are overly slow
Description
On the (small) test machine, some queries take a lot of time :
When displaying a node
2011-11-22 14:20:50 CET rudder rudder LOG: exécute <unnamed>: select executiondate, nodeid, configurationruleid, policyinstanceid, serial, component, keyValue, executionTimeStamp, eventtype, policy, msg from RudderSysEvents join (select
nodeid as Node, max(executiontimestamp) as Time from ruddersysevents where configurationRuleId = 'hasPolicyServer-root' and component = 'common' and keyValue = 'EndRun' group by nodeid ) as Ordering on Ordering.Node = nodeid and execution
TimeStamp = Ordering.Time where 1=1 and configurationRuleId = $1 and serial = $2 and executionTimeStamp > (now() - interval '15 minutes') and nodeId = $3
2011-11-22 14:20:50 CET rudder rudder DÉTAIL: paramètres : $1 = 'hasPolicyServer-root', $2 = '35', $3 = '06da3556-5204-4bd7-b3b0-fa5e7bcfbbea'
2011-11-22 14:20:56 CET rudder rudder LOG: durée : 5701.757 ms
2011-11-22 14:23:54 CET rudder rudder LOG: instruction : select executiondate, nodeid, configurationruleid, policyinstanceid, serial, component, keyValue, executionTimeStamp, eventtype, policy, msg from RudderSysEvents join (select nodei
d as Node, max(executiontimestamp) as Time from ruddersysevents where configurationRuleId = 'hasPolicyServer-root' and component = 'common' and keyValue = 'EndRun' group by nodeid ) as Ordering on Ordering.Node = nodeid and executionTimeS
tamp = Ordering.Time where 1=1 and configurationRuleId = 'hasPolicyServer-root' and serial = '35' and nodeId = '06da3556-5204-4bd7-b3b0-fa5e7bcfbbea';
2011-11-22 14:24:07 CET rudder rudder LOG: durée : 13198.511 ms
A view would be great, or at least an optimisation on the inner query