Store gravatar URL in user database - faster?

256 Views Asked by At

I building a user system and decided to use the Gravatar (I know, I know) system for user icons.

Since Im already accessing the database to grab user data, I was wondering if it made sense to store the users's gravatar URL in the database so I didn't have to take their email address and MD5 it every time it is used.

In PHP 5.2.X - And I assume that MD5 is pretty quick. But wouldn't it be quicker not to do it an just grab it from the DB?

2

There are 2 best solutions below

0
On BEST ANSWER

Storing and retrieving the extra data in each database row would likely take more time than the md5 would. MD5 is a very fast operation, especially on input as small as an email address.

2
On

There's no way doing one MD5 is slowing you down. If you're really so worried about it, do it in Javascript on the client side, since you don't need the Gravatar - the users do.

This is provided that you expose the email addresses, of course.