I've got a site with about 1000 users and 6000 profile fields values. I've traced a bottleneck in various modules to profile_load_profile (alt_login, masquerade, webform). The sql query takes about 20 ms. I don't understand why there's an index on fid, which does not filter all that much, and not on uid, which is the main issue there.

After connecting to the database by hand and adding a simple
create index uid on profile_values (uid);
the query from profile_load_profile is down to 1ms or less, and the site is dramatically faster.

I believe this index would be a fine addition. Probably two lines to profile.install to create it, and an update snippet as well...

Comments

nicolash’s picture

I second that. If you make use of user profile fields in views, a single page request may call this any number of times. The index on uid increases performance dramatically (in my case from several seconds to 0.5ms) and it's an easy win, since they get written much less than they get read.

But this might be a bit late....

handrus’s picture

Assigned: Unassigned » handrus
Status: Active » Needs review
StatusFileSize
new832 bytes

This is indeed a very simple addition, makes total sense since both are also primary fields

handrus’s picture

Assigned: handrus » Unassigned
Priority: Normal » Major
handrus’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 2: Drupal_Core-profile_performance_issue-598120-2.patch, failed testing.

Status: Needs work » Needs review
handrus’s picture

Status: Needs review » Reviewed & tested by the community

Just re re-test it, not sure if anyone will be looking for D6 anymore, but I'm trying ;)

Status: Reviewed & tested by the community » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.