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
Comment #1
nicolash commentedI 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....
Comment #2
handrus commentedThis is indeed a very simple addition, makes total sense since both are also primary fields
Comment #3
handrus commentedComment #4
handrus commentedComment #7
handrus commentedJust re re-test it, not sure if anyone will be looking for D6 anymore, but I'm trying ;)