Scenario: Hi/Lo is initialized for MyEntity with Lo 100
The table is empty.
Two sessions with different connections have both inserted three items.
TableIds
1
2
3
100
101
102
If a third one comes in at a later time and inserts three items:
TableIds
...
200
201
202
Is there a way to not get these gaps?
As
Phillquite rightly pointed out the gaps appear when you build asessionFactorye.g. the application restarts etc or you are running on the cloud and each node has its own set ofHiandlo.You could reduce the lo to
10rather than100to reduce the gaps and/or I recommend usingint64rather thanint32for ease of mind.However does the gaps actually matter? Would you ever see yourself running out?
I have never read anything negative about performance (database issues) with a large number of gaps when using
Hilo. The only thing I have seen is that some people complain that they run out when usingint32or when thelohas been set to high.