[development] should I alter the sessions table?

Henrique Recidive recidive at gmail.com
Tue Mar 31 19:18:26 UTC 2009


2009/3/31 David Cohen <drupal at dave-cohen.com>:
> 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.
> (http://forum.developers.facebook.com/viewtopic.php?id=21931)
>
> 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?

Surely there will be a performance hit, due to longer indexes.

> 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?

Can't you just save you key in a session variable (e.g. $_SESSION['fb_key']) ?

Henrique

> Thanks in advance,
>
> -Dave
>
>
>


More information about the development mailing list