Database Auto Increment Vs Sequence

Auto Increment:

Easy to use.

Fail in concurrent system.

If you roll back transaction, number will go down.

When taking purging and starting on new year day, it start with 1. Which may spoil the integrity of data during backups.

We can’t change the sequence…

Sequence:

Easy to use.

Wont fail in concurrent system.

Sequence wont participate in transaction. Number is same after rollback.

No issues during purging data. Still it continues with highest number.

We can change the sequence if required.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s