Session id length in sessions table

Dear all,

I just created session with rake db:sessions:create and run the
migration
also. When I run my apps, my db barfed out saying that the length of
session_id is too long. When I checked into my db, the length of
session_id
column in the sessions table, it was 255 of character varying. I then
changed it to 500 character varying and it works. But that would be too
long. Does anybody know the exact length of this field?

Thank you in advance.


If you can’t believe in God the chances are your God is too small.

Read my blog: http://joshuajava.wordpress.com/
Follow us on twitter: http://twitter.com/scrum8

Hi there,

Not a DB expert but as far as I understand when you have a “varying”
field you are telling the DB how long the data in the field/column
could be. If you put a value that is shorter than the maximum
possible length the DB should arrange the storage for as much data as
you put in the field and no more, so ‘extra empty space’ is not
wasted. In other words, I think you should be fine, especially if you
clean up session information as sessions expire.

Pepe

On May 5, 8:42 am, Joshua P. [email protected] wrote:

Dear all,

I just created session with rake db:sessions:create and run the migration
also. When I run my apps, my db barfed out saying that the length of
session_id is too long. When I checked into my db, the length of session_id
column in the sessions table, it was 255 of character varying. I then
changed it to 500 character varying and it works. But that would be too
long. Does anybody know the exact length of this field?

It’s not normally anywhere near that long. if you are moving from an
app that was using the cookiestore session storage then you’ll need to
clear out the sessions (because with the cookie store the session id
is the session data)

Fred