On Nov 12, 7:47 am, [EMAIL PROTECTED] (E R) wrote: > On Nov 11, 2007 3:58 PM, mmccaws2 <[EMAIL PROTECTED]> wrote: > > > I have an integer field that tracks entries. The question I have is > > can I set an option so that when auto_increment reaches it's maximum > > integer value, it will start all over at zero. I'm deleting every 15 > > minute the earlier entries, so I'm not too worried about the table > > growing too large. Can mysql be set to roll once it's max value is > > reached? > > May we ask what you are really trying to do? Perhaps there is another > way to accomplish your goals. > > ER
Sure My program reads in a set of device names from a syslog file once every two minutes. For the purposes of my program, a device is considered "old" after a half hour at which time the program removes the old. Just for general accounting, I'm keeping track of device quantities by just tracking the key which auto increments. This table doesn't require a primary key, and I could just track quantities in another table. The fields are deviceid, devicename, timestamp, and perltime. I don't really need deviceid nor timestamp. I've never used time fields in mysql and i use them to see that things are being added and when. The perltime field, time(), is so that I can count off the half hour in seconds. So I was just curious if there was a way to set deviceid to smallint, and allow it to automatically roll the number to 1 when the max int was reached. Less house keeping. There are only a couple thousand devices that pop up as many as 10 times a day in syslog, so I could use a larger int or track it by counting. Always open for suggestions Mike
