This week's book giveaway is in the Kotlin forum.We're giving away four copies of Kotlin for Android App Development and have Peter Sommerhoff on-line!See this thread for details.
Win a copy of Kotlin for Android App Development this week in the Kotlin forum!
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
• Liutauras Vilda
• Devaka Cooray
• Jeanne Boyarsky
• Bear Bibeault
Sheriffs:
• Junilu Lacar
• Paul Clapham
• Knute Snortum
Saloon Keepers:
• Ron McLeod
• Tim Moores
• Stephan van Hulst
• salvin francis
• Carey Brown
Bartenders:
• Tim Holloway
• Frits Walraven
• Ganesh Patekar

# any alternative to using sequence numbers?

Greenhorn
Posts: 28
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: 17344
11
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

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.

 All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad: RavenDB is an Open Source NoSQL Database thatâ€™s fully transactional (ACID) across your database https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database