This is just a consideration for a site am creating and for other big sites out there.
I am using Identity Column to store the ID of some of my tables and I have classes whose Id are decorated with Int32 to hold the value of the ID retrieved from database.
My worry is that as the site grows bigger, some tables that grows exponentially e.g QuestionComments might exceed the Int32 limit in future. So I change my class to use long.
public class Question
{
public long QuestionID { get; set; }
...
}
//Converting database value to .Net type
Question q = new Question();
q.QuestionID = Convert.ToInt32(myDataRow["QuestionID"]);
How true is my assumption? Would using a UniqueIdentifier be better? Are there other way to address this?
Can you imagine billions of records being stored for any one entity? If so you could switch to
BigIntwhich is otherwise known asInt64. Of course once you start seeing many millions of records you need to start thinking about data partitioning and archiving to avoid serious performance issues. If you have a infrastructure team you may want to let them know that you expect heavy usage and will need a serious maintenance plan. If you are the infrastructure team then you better hit the books!