![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
We use the GUID type string. |
#3
| |||
| |||
|
#4
| |||
| |||
|
|
What do you thing how slow will that be if string is used as primary key field type? I know most of the primary key defined as integer type (eg.auto-increment). We are using string as primary key field type: VARCHAR(36). We use the GUID type string. |
#5
| |||
| |||
|
|
What do you thing how slow will that be if string is used as primary key field type? I know most of the primary key defined as integer type (eg.auto-increment). We are using string as primary key field type: VARCHAR(36). We use the GUID type string. |
#6
| |||
| |||
|
|
GUIDs are awful for a bunch of reasons and you should spend the effort to engineer them out of your system if at all possible. |
#7
| |||
| |||
|
#8
| |||
| |||
|
|
GUIDs are awful for a bunch of reasons and you should spend the effort to engineer them out of your system if at all possible. Hi, At the moment I am migrating our old desktop database to MySQL as it should be a generic question no matter MySQL or MSSQL Server. There is NOT really a primary key in the old database tables so I started using the GUID function from programming tools. But strip off the opening and closing braces. eg 003FBAB9-C0E9-49BA-8922-661101DA03D8 In old tables, the fields will be something like for employee table (master table): EmpNo EmpName AP001 Andy Penn I defined the primary key as VARCHAR(36) for each table to make like EmpID EmpNo EmpName 003FBAB9-C0E9-49BA-8922-661101DA03D8 AP001 Andy Penn The reason of NOT using auto-increment because of difficulties when I faced: 1) data migration I need to link master table to detail table, if I use auto-increment: When I migrate 1 master record, I need to fetch the new auto-increment integer from master table, there is another database retrivel trip. Employee (master table) --> Emplyee Orders (detail table) Such as while still more old employee records import old employee record into new employee table get this new primary key from new employee table (ie. EmpID) import employee orders with this new EmpID as foreigh key end; if I generated 36 character string in my migration utility: while still more old employee records generate 36 character string as EmpID import old employee record into new employee table with this new EmpID import employee orders with this new EmpID as foreign key end; What do you think? |
![]() |
| Thread Tools | |
| Display Modes | |
| |