Re: Serial Data type
Posted in 1995
> hrilantono@wtc.com (sysher) writes: > > What should I do if I want to roll over a serial data type? > i,e: I've a table that I'll doing 6000 inserts daily. 1 mo later I'll > deletes these rows, but the serial col will keep incrementing. What > should I do when the col. hits max? > > Thanks... > > --------------------------------------------------------------------- > P E A C E O N E A R T H > hrilantono@wtc.com > ===================================================================== > > >>>> This might be an RTFM, but: Assuming you start at serial value 1 and insert 6000 records every day of the year: Start worying somtimes in year 2975 (if it's still peace on earth). If you can accept negative values for your serial column you have until year 3956. (The max. value is 2**31 or 2,147,483,648) As far as I know, the only wory will be that the same values that are used now for the serial column will be reused at that time. That should be no problem though, as you say you delete the rows every month. If you insert a record every second you have about 6.8 years until the serial values become negative, and another 6.8 years before they are reused. If the problem is that you dislike large numbers (there are often good reasons for that) the most efficient solution is probably to create a new table. If you delete all rows in the table every month it's usually more efficient to delete the whole table and create it again with the same name. If some rows are retained (i.e. the last month worth, older removed), it may be possible to make your program use two alternating tables. Nils.Myklebust@ccmail.telemax.no NM-data, Dalsbergstien 7, N-0170 Oslo, Norway My opinions are those of my company