Question

I have seen a couple threads about what everyone was doing now a days in regards to signed vs unsigned key values. It would seem that unsigned is optimal since it allows twice the number of rows for the same cost. Are there any benefits with signed keys?

Is there any standard consensus? Its seems like signed is the answer since "it has always been that way"

Was it helpful?

Solution

I prefer to set my columns as unsigned if they cannot be negative. Besides the range factor that you mentioned, it also makes it clearer when reading the table definition.

OTHER TIPS

A signed 32-bit int can represent over 2 billion numbers so I suspect the issue is moot for most people. That said, I often use negative numbers when I want to indicate that a record is purposefully orphaned.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top