Long time for sql-report

This forum post has been removed

Number of replies: 4
The content of this forum post has been removed and can no longer be accessed.
In reply to Deleted user

Re: Long time for sql-report

by David Saylor -
Could your problem be here? It looks like you'd be duplicating group ids for every single course which could be causing a lot of additional render time for the plugin.
INNER JOIN prefix_groups_members ON u.id = prefix_groups_members.userid

I think you should be JOINing the groups table and limiting by courseid.
In reply to David Saylor

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.
In reply to Deleted user

Re: Long time for sql-report

by David Saylor -
I don't have the data you're working with, so I can't say for sure that this will help you, but it seems inefficient as is.

INNER JOIN prefix_groups_members ON u.id = prefix_groups_members.userid

should become
INNER JOIN prefix_groups groups ON groups.courseid = c.id
INNER JOIN prefix_groups_members ON groups.id = prefix_groups_members.groupid AND u.id = prefix_groups_members.userid

If you want the group to be optional (for example, show a user's data even if they aren't in a group) then do this instead:
LEFT JOIN prefix_groups groups ON groups.courseid = c.id
LEFT JOIN prefix_groups_members ON groups.id = prefix_groups_members.groupid AND u.id = prefix_groups_members.userid
Average of ratings: Useful (1)
In reply to David Saylor

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.