tags:

views:

106

answers:

2

Should I use high numbers for user IDs in database? Are there any benefits with starting user_id from 1000 (from <9000 users project) or 10000 for more...?

+1  A: 

not really. I would just start from 1. if you have any needs to put stuff in before one, there are no issues w/ using negative numbers, so you can just do an insert and manually specifiy the id. At my company, we start all the users at one, auto incrementing, and our global admin user is ID 0.

Darren Kopp
+3  A: 

The advantage of starting user IDs from 1000 (even when you will have fewer than 9,000 IDs) is that they will all have the same number of digits, so that files, for example, suffixed with the UID will sort in numeric order automatically, even if the sorter only uses alphabetic numbering. And you don't have to pad the numbers with leading zeroes to get there.

The converse is that if you only have 1000 users, numbers starting at 1,000,000,000 would look a little silly: 1,000,000,001 then 1,000,000,002 and so on.

For many purposes, therefore, it doesn't matter which you do. A uniform number of digits has some advantages, and that is why a value other than zero or one is often used as the starting point.

Jonathan Leffler
When I was a kid -- 70's era programming -- consistent number of digits was *Really Important*. But that was so COBOL programs and dumb sort utilities would work out well. Nowadays, there's no need for this kind of foolishness. Start at 1 and don't try to micro-optimize this kind of thing.
S.Lott
+1. It happened in COBOL?! Anyways good to know it mattered once.
Guru