On Jul 6, 8:22 am, Massimiliano della Rovere <massimiliano.dellarov...@gmail.com> wrote: > Greetings, > I am creating an event logger; each event spans in time from datetime > to datetime. > Each event is uniquely identified with the couple > event_start_date_time and event_id (ranging from 0 to 9999). The > Hardware event trapper automatically wraps the event_id. > I am the programmer of the event logger, external to django, so I can > decide how to shape the DB table; the plan is using the admin > interface to browse through the logged events. > > Now my problem is that there can be something like 25,000 events per > day and that the default auto_increment field (technique) will sooner > or later exhaust. > So I thought that, even though the MySQL limit for SERIAL (=BIGINT > UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE) fields is > 18,446,744,073,709,551,615, I could use a composite primary key in > django but I was wondering if there are any ForeignKey and > ManyToManyField vs unique_together issues in django. > > Another idea springing in my mind is using a string as primary key > composed by the concatenation of event_start_date_time.isoformat() and > event_id. > > Which solution is best in your opinion?
I think you are worrying unnecessarily. With 25,000 events per day, it will take you 20,215,609,943,791 years to exhaust the bigint field. If you need to plan for your server to still be running 20 trillion years in the future I think you will have more problems than that. -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.