Page 1 of 1

Performance - string ID vs int ID

Posted: Thu Jun 22, 2006 7:43 am
by Ree
Right now I am developing a PHP app which is going to use the data of users and user groups stored in Active Directory server. I have decided to refer and identify users and user groups in AD using "objectGUID" property. Since the same users are going to have their entries (as well as any app-specific data assigned to them) stored in my app's db, I was wondering if there would be a noticeable performance hit if I used base64 encoded "objectGUID"s as IDs instead of the usual integers? Obviously, in this case any ID based relations stored in other db tables would have to store base64 strings. Since objectGUID is already an object ID in Active Directory, I am a bit reluctant to add additional integer IDs in my app's db since objectGUID is guaranteed to be unique, however, if the performance may suffer noticeably, I would change my mind. Btw, base64 encoded objectGUIDs I think are no less than ~20 chars.

Btw, I am going to use SQL Server 2000 db for my app.

Posted: Thu Jun 22, 2006 8:56 am
by feyd
If it's an actual GUID (128-bit number) using the binary form is likely most efficient. Whether it's visually appealling or not is debatable, but that doesn't matter. No one is supposed to see it except the application. If you need to output it, I would give out the string version:

Code: Select all

{4B0FC485-E467-4e0b-A66D-8D52FABC9B5D}

Posted: Thu Jun 22, 2006 9:13 am
by Ree
Is objectGUID actually something 'which nobody should ever see'? I was thinking about passing it in a query string like this: user-details.php?user={base64_encoded_objectGUID} and then decode the param to get the raw objectGUID and use it to query AD.

I guess storing objectGUIDs as binaries is a good idea. However, when comparing strings and integers... the latter is better as a record ID, correct? If so, is the difference actually noticeable?

Posted: Thu Jun 22, 2006 9:32 am
by feyd
However, when comparing strings and integers... the latter is better as a record ID, correct?
It's pretty simple to compare both, so some testing may be in order. The string form will use slightly more memory often.