ok, the query is really inefficient
it's much more efficient to do
select r.nodeid, r.date, r.nodeconfigid, r.complete, r.insertionid,
c.nodeid, c.nodeconfigid, c.begindate, c.enddate, c.configuration from
(select reportsexecution.nodeid, reportsexecution.date, reportsexecution.nodeconfigid, reportsexecution.complete, reportsexecution.insertionid from
reportsexecution where nodeid in (values ('cfc8fe3d-09e6-4680-aea9-e347385753a2'),('540bc906-c672-49ce-acab-240d6e65676b'),('9b295838-6e8e-481b-927d-1e1891c317b2')) and (nodeid, insertionid) in
(select nodeid, max(insertionid) as insertionid
from reportsexecution
where complete = true
GROUP BY nodeid)) as r
left outer join nodeconfigurations as c
on r.nodeId = c.nodeid and r.nodeconfigid = c.nodeconfigid;
or
select r.nodeid, r.date, r.nodeconfigid, r.complete, r.insertionid,
c.nodeid, c.nodeconfigid, c.begindate, c.enddate, c.configuration from
(select reportsexecution.nodeid, reportsexecution.date, reportsexecution.nodeconfigid, reportsexecution.complete, reportsexecution.insertionid from
reportsexecution where (nodeid, insertionid) in
(select nodeid, max(insertionid) as insertionid
from reportsexecution
where complete = true
and nodeid in ((values ('cfc8fe3d-09e6-4680-aea9-e347385753a2'),('540bc906-c672-49ce-acab-240d6e65676b'),('9b295838-6e8e-481b-927d-1e1891c317b2')))
GROUP BY nodeid)) as r
left outer join nodeconfigurations as c
on r.nodeId = c.nodeid and r.nodeconfigid = c.nodeconfigid;