Skip to content

Conversation

@aneno-m-e
Copy link

One of our clients is facing performance issues (504 Gateway Time-out) when using this plugin in certain courses.

We've identified the function get_all_groups_of_choices as a cause and rewrote it to minimise the number of database queries done in order to retrieve $groupids.

@dlmsr dlmsr self-assigned this Feb 25, 2025
@dlmsr dlmsr added this to the Release 5.0.0 milestone Jul 11, 2025
@aneno-m-e aneno-m-e force-pushed the improve-performances branch from 24ca210 to 11f3818 Compare September 3, 2025 02:47
@dlmsr
Copy link
Member

dlmsr commented Oct 24, 2025

Hi @aneno-m-e, thanks for your contribution which is a real improvement. Is there a reason why you do not have the following query (note the WHERE clause):

  SELECT DISTINCT
    g.id
  FROM
    {ratingallocate_choices} c
    JOIN {ratingallocate_group_choices} gc ON gc.choiceid = c.id
    JOIN {groups} g ON gc.groupid = g.id
  WHERE
    c.ratingallocateid = ?
    AND c.usegroups = 1
    AND c.active = 1;

This is what I considered when reviewing get_all_groups_of_choices.

@aneno-m-e
Copy link
Author

Hi @dlmsr

I had a look at the query and I believe the only reason we didn't include AND c.usegroups = 1 AND c.active = 1; was because we needed a fix asap and didn't get the opportunity to optimise the query as well as could be.

@dlmsr
Copy link
Member

dlmsr commented Nov 6, 2025

Ok, thanks. Then I am going with my version of the query :)

@dlmsr dlmsr force-pushed the improve-performances branch from 11f3818 to f5943de Compare November 6, 2025 12:59
@dlmsr dlmsr force-pushed the improve-performances branch from f5943de to 60ea456 Compare November 6, 2025 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants