Moodle

Add index to user_info_data table

Details

  • Database:
    Any
  • Difficulty:
    Easy
  • Affected Branches:
    MOODLE_19_STABLE, MOODLE_20_STABLE

Description

Some tasks in Moodle that use the custom user profile fields could be greatly improved by the addition of a database index on the 'userid' and 'fieldid' fields. It would also be great to have one on the 'data' field, but this is not possible as it is a 'text' type and will not work on all database technologies.

Simply adding a new index such as 'userfieldidx' based on the 'userid' and 'fieldid' fields can speed up a number of queries.

I have attached a patch (would need adjusting for the version bump) that would do this. This could (should) be applied to 2.0 as well.

Issue Links

Activity

Hide
Dan Marsden added a comment -

Hi Mike,

I think you've added the wrong upgrade code here - looks like you're adding a new id field rather than the index - I've just checked 2.0 and the id field exists - is it missing in 1.9?

Show
Dan Marsden added a comment - Hi Mike, I think you've added the wrong upgrade code here - looks like you're adding a new id field rather than the index - I've just checked 2.0 and the id field exists - is it missing in 1.9?
Hide
Mike Churchward added a comment -

You're right Dan. I picked the wrong db item. I have corrected that and uploaded a new one.

Show
Mike Churchward added a comment - You're right Dan. I picked the wrong db item. I have corrected that and uploaded a new one.
Hide
Eloy Lafuente (stronk7) added a comment -

Raising to critical, assigning to Andrew, sending to stable backlog.

As far as this duplicates MDL-17201 surely this will end being closed like that. But I keep that for Andrew, as far as there is one patch to look here.

Thanks for the report and patch! Ciao

Show
Eloy Lafuente (stronk7) added a comment - Raising to critical, assigning to Andrew, sending to stable backlog. As far as this duplicates MDL-17201 surely this will end being closed like that. But I keep that for Andrew, as far as there is one patch to look here. Thanks for the report and patch! Ciao
Hide
Andrew Davis added a comment -

Resolved as part of MDL-17201

Show
Andrew Davis added a comment - Resolved as part of MDL-17201

People

Vote (1)
Watch (3)

Dates

  • Created:
    Updated:
    Resolved: