#1 2019-10-02 12:38:27

belkys
Member
Registered: 2019-10-02
Posts: 3

TID Guid

Hello friends!

No matter the performance costs, I would like to adapt the TID class to GUID ...

Has anyone here ever done? Is there any prediction to be made?

Thanks!

(BY GOOGLE TRANSLATION)

Offline

#2 2019-10-07 08:47:59

itSDS
Member
From: Germany
Registered: 2014-04-24
Posts: 506

Re: TID Guid

I think it will not work cause the TID as int64 is essential for mORMot and massivly used internally


Rad Studio 12.1 Santorini

Offline

#3 2019-10-07 13:07:02

edwinsn
Member
Registered: 2010-07-02
Posts: 1,215

Re: TID Guid

Agree with @idSDS


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

#4 2019-10-07 20:21:47

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,237
Website

Re: TID Guid

We defined the TID to follow the SQlite3 integer primary key, which is a Int64.
It is from the ground up to SQLite3 and to mORMot.

Using random GUID is IMHO a bad practice, especially in term of performance: integer sequences will put the inserted data in order in the disk, which is exactly what you expect most of the time.
With SQlite3, you could use a GUID blob field with an index, and good performance.... but behind the scene it will still do a lookup from a Int64 ID, so it will always be slower, and consume disk space for no benefit.

If you want to have genuine generated TID values across several ends, see our TSynUniqueIdentifier which was meant exactly for this purpose - still using Int64.

Offline

#5 2019-10-09 11:07:03

belkys
Member
Registered: 2019-10-02
Posts: 3

Re: TID Guid

Ok, I really need this. We will fork to meet our demand. We use Oracle and we always will, so this fork makes a lot of sense to us. Thank you all! Strong hug.

Offline

#6 2019-10-09 15:30:31

mpv
Member
From: Ukraine
Registered: 2012-03-24
Posts: 1,543
Website

Re: TID Guid

Just for information: some years ago we do a refactoring of a huge system (MS SQL ~100millions of rows in some tables) where GUID`s are used as a primary keys.  After migrating to Int64 database operations become MUCH faster (index over int64 use less space compared to GUID so more data can be in memory cache, tables use less space so more data can fit in memory etc.) And this is MS SQL where GUID support is very good. I think for Oracle GUID is a big problem. For big databases, of course

Offline

#7 2019-10-22 12:42:09

belkys
Member
Registered: 2019-10-02
Posts: 3

Re: TID Guid

Friends are very right. I was seduced by the fact that I could exchange information between repositories without the worry of ID collision. ID Int64 can be safely used as long as there is a plan to do so.

Offline

Board footer

Powered by FluxBB