Primary key as INT and global key as GUID for better performance

When choosing keys for a table, is it useful to have a primary key INT (auto-increment) for the table and a GUID (in addition to INT) for the database area? Given that there will be more DML table statements, it will work faster with INT, whereas if any PML database statements were executed, a GUID would be useful. Please note that I use MySQL, just in case it matters. Please discuss.

+3
source share
1 answer

I did this before, and it worked successfully: as you indicate, use GUIDmeans that we avoided conflicts when merging, say, data from one database with another, and intprovided us with efficient joins, etc. I would never use it GUIDas a key when you are dealing with OLAP, as this will be performance.

+2
source

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


All Articles