HiLo or personality?

I just wanted to get some opinions about primary keys - would it be better to use identification numbers / sequences or use the HiLo strategy (query for a large value and increase the minimum value for the application itself)?

+3
source share
2 answers

If your application would use only one database, I would go with an identifier / sequence.

The only truly reasonable reason I've seen working with HiLo is when you can have two disconnected instances of your application that people can work with at the same time, and you need to reconcile the differences at some point.

Ex . You are working on a content management system where people can work on two different servers in different places, but at some point they should be synchronized.

+2
source

If you are using SQL Server 2005/2008 with a large table (> 1 million rows), you can consider this , which references this . In certain circumstances, a problem arises with the identifiers scope_identity () and @@.

Of course, developing around the current implementation problem is not always the wisest solution.

+6
source

Source: https://habr.com/ru/post/1304187/


All Articles