[development] should I alter the sessions table?

David Cohen drupal at dave-cohen.com
Tue Mar 31 18:47:09 UTC 2009

I have a special need, in the Drupal for Facebook modules, to honor a
session key that comes from Facebook, instead of the key Drupal normally
uses.   So far the way I've approached this is to have Drupal use the
passed-in session_key, so the sid column of the sessions table is that
value.  My problem is the the length of these session keys is sometimes
longer than the 64 character limit of the sid column.  According to
Facebook these keys could be 128 characters or even longer.

My first thought is to alter Drupal's sessions table.  That is, in my
module's .install file I would alter sessions so that the sid column is
varchar(256) instead of varchar(64).  Is there a performance drawback to
this?  Is it bad form to alter the table this way?

My other options include finding some way to compress the session_key
down to 64 chars.  Or, create a table that maps longer session_keys to
Drupal's sids.  Is there any reason to go with one of these options as
opposed to altering the table?

Thanks in advance,


More information about the development mailing list