Win a copy of Spring in Action (5th edition) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

any alternative to using sequence numbers?  RSS feed

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

i am using sequence numbers to uniquely identify the rows in a table.
But the numbers of rows that will be inserted daily will be in the order of thousands .. (1000-3000). So it is possible that the sequence nos get used quickly and the prev data will be overrriden (assuming that all the data is required for some time)

Is there any alternative to using sequences??
Also performance wise will there be any problem in using sequences in this case
(I am no goood in DB pls suggest!!)

Thanks
Sunitha
 
ranger
Posts: 17314
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The sequence tables can go to a very very large number, so even at 100 per day, you shouldn't run out. You can also cache a good number of them at a time, so the performance is better.

The other option is to have the Application determine the next number, in which cas you would have to do a query on the table to determine the highest number already used and add 1 to it.

I prefer the Sequence Table better.

Mark
 
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Mark Spritzler:
The sequence tables can go to a very very large number,



The maximum Oracle sequence number is 10 ** 27, or
1,000,000,000,000,000,000,000,000,000

If you use 1 billion (American billion, 10**9) a day, you will run out in a billion billion days.

Most people find that adequate.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!