# Simple Database Problem

**URL:** <https://www.ruby-forum.com/t/simple-database-problem/104274>\
**Category:** Rails\
**Created:** [May 16, 2007, 8:23am UTC](https://www.ruby-forum.com/t/simple-database-problem/104274 "2007-05-16T08:23:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![The\_iGuy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c0e974/32.png) [@The\_iGuy](https://www.ruby-forum.com/u/The_iGuy)\
**Post date:** [May 16, 2007, 8:23am UTC](https://www.ruby-forum.com/t/simple-database-problem/104274/1 "2007-05-16T08:23:33Z")

</div>

I have a question about auto generated primary keys. For example  
rails’ session table in MySQL uses an int(11) with auto\_increment. If  
the application is used a lot wouldn’t the id key run out of keys  
eventually? How do you deal with this problem in general, not just for  
the session table.

Do you run a clean up script in an interval witch drops the table and  
recreates it?  
If so what if the tables data is important?

Or do you create your own keys?  
If so how do you create a unique key?

I know this is a vague question an the answer could get complicated  
but I thank anyone for any help here.

Thanks,  
Scott
