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.