3

Has anyone else just counted up from -1 in the https://stackoverflow.com/users/XXXX (where X is numbers)?

Why do regular Stack Overflow users start at 1 rather than the usual 0? Was someone who knew Cobol on the team? ;)

Also, anyone else seen https://stackoverflow.com/users/10 ?

And why are there random gaps in the account numbers? Is this just where accounts were deleted?

  • 2
    I would think quite a number of the first few tens of IDs might be that of test accounts and were deleted/disblaed subsequently. – o.k.w Mar 1 '10 at 2:10
4

Has anyone else just counted up from -1 in the https://stackoverflow.com/users/XXXX (where X is numbers)?

Not me

Why do regular Stack Overflow users start at 1 rather than the usual 0? Was someone who knew Cobol on the team? ;)

Because if (0) returns false; this is usually undesidered and may lead to surprising effects if not considered. Additionally an unregistered user could be considered by the system as having ID 0 (and now if (0) makes sense).

Also I don't know about you but if I'm counting how many people there are in the room I start with 1, not 0. And I'm a hardcore C++ programmer, but starting counting from 0 outside of C++/arrays seems silly.

And why are there random gaps in the account numbers? Is this just where accounts were deleted?

Yes

  • 1
    Counting from 0 outside of arrays might be silly, but it would mean I wouldn't always have to subtract 1 from array.length – Mark Henderson Mar 1 '10 at 4:13
5

The numbers would start at 1 because it's a database, and databases, in my experience, start at 1 for the autogenerated primary key.

I'm with Koper, I haven't navigated the users in numerical order either.

4

The User Id is represented by an auto-incrementing int in the database.

The StackExchange software uses SQL Server as their DBMS system. SQL Server uses IDENTITY to specify an auto-incrementing field. The default parameters for IDENTIDY is seed 1, increment 1.

In English, this means that the first value is 1, and the next value is generated by incrementing 1 to the previous.

IDENTITY (Property)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .