# Simple Database Problem

**URL:** <https://discuss.rubyonrails.org/t/simple-database-problem/13012>\
**Category:** rubyonrails-talk\
**Created:** [May 16, 2007, 6:22am UTC](https://discuss.rubyonrails.org/t/simple-database-problem/13012 "2007-05-16T06:22:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![The\_iGuy](https://avatars.discourse-cdn.com/v4/letter/t/c0e974/32.png) [@The\_iGuy](https://discuss.rubyonrails.org/u/The_iGuy)\
**Post date:** [May 16, 2007, 6:22am UTC](https://discuss.rubyonrails.org/t/simple-database-problem/13012/1 "2007-05-16T06:22:54Z")

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