Description
The user audit query if you have a lot of audit records.
select * from (
select * from grouper_audit_entry auditentry0_
where auditentry0_.act_as_member_id='ff66dc7cd2ea4dc49c6459b189a926b9'
or auditentry0_.logged_in_member_id='ff66dc7cd2ea4dc49c6459b189a926b9'
and (auditentry0_.act_as_member_id is null) order by auditentry0_.created_on desc )
where rownum <= 6
There seem to be 2 problems here. One is that the query has an OR for both act_as_member_id and logged_in_member_id. Two is the "order by".
There are probably multiple ways to solve this but one way would be to change the API to always populate act_as_member_id so we don't need to look at logged_in_member_id in the query. And then add a composite index to fix the performance of the "order by" – create index asdf on grouper_audit_entry (act_as_member_id, created_on)