Thank you for this report, this is really helpful for us !
So, some insight on the numbers:
SELECT tables.table_name FROM information_schema.tables WHERE lower(table_name) = '';
is the check made by the JDBC driver to check the connection is still alive. It is obviously made too often
select id from ruddersysevents limit 0;
is the check made by the rudder-agent to check the postgres database is up and running
insert into RudderSysEvents (executionDate, nodeId, ruleId, directiveId, serial, Component, KeyValue, executionTimeStamp, eventType, msg, Policy) values ('','', '' , '', '', '', '', '', '', '', '' );
is the insertion of nodes reports in the databases
Select "statusupdate4"."key" as "statusupdate4_key", "statusupdate4"."date" as "statusupdate4_date", "statusupdate4"."lastid" as "statusupdate4_lastid" From "statusupdate" "statusupdate4" Where ("statusupdate4"."key" = '');
update "statusupdate" set "lastid" = (0), "date" = ('') Where ("statusupdate"."key" = '');
select T.nodeid, T.executiontimestamp, coalesce(C.iscomplete, false) as complete from (select distinct nodeid, executiontimestamp from ruddersysevents where id > 0 and id <= 0) as T left join (select true as isComplete, nodeid, executiontimestamp from ruddersysevents where id > 0 and id <= 0 and ruleId like '' and component = '' and keyValue = '') as C on T.nodeid = C.nodeid and T.executiontimestamp = C.executiontimestamp;
select max(id) as id from RudderSysEvents where id > 0 and executionTimeStamp < '';
are the computation of last time a node answered.
It seems clear to me that we should check the connection to the database much much less often. I'll be working on this one
As for the commit, indeed every requests are atomic; but i can't understand why there are so many of them (80103+24299, while there is only 37743 + 25100+863+750+124 insert/update