A while back I witnessed how the profile properties of ASP.NET are stored in the database. All the properties all stored in one string. There is then another string that describes the properties and how to view them and pull them from the database.
For example you have this string:
Then you have another string that looks like this:
If you break it down correctly you could get something like this:
- Property Name : SmtpServer
- Property Type : string (S) <-- Or this could be the Serialize As Type
- Property Start Index : 0
- Property String Length : 18
Now the question that I ask my self is:
Does this actually increase performance of the system?
I would argue yes and no. Since the system could have an infinite amount of members attached to it and a countless amount of profile properties. It would need to have something like this to decrease the amount of rows owned by a single user in the profile table. To give an example, I could be one user with 20 propertie. If the application had over 1,000,000 users, that would be 20,000,000 rows. That is huge and you must design for scale when it comes to an application that could potentially be used by all the world.
I would argue no to small applications. If you only ever expect 1,000 users to an application, then why build something this complex other than for the thrill of it. This is especially the case when you don't need to worry about space on the system. Space is cheap, but time spent coding a solution for this sample could be huge depending on experience.
I personally would build a generic code base for two ideas of this kind. You could first build the generic code for the example above, but there would be another generic sample to build for. Lets say that you knew you were only going to ever store numbers in your database for each user. These numbers could be used for ID's of another tables real data. So I only want to store ID's of a table for each user.
I would store them like:
This is because I wouldn't need another cell to split them up with indexes. I would just split the numbers by the Colon. I would love to hear everyone's thoughts on this and why or why not it is a good choice. Thanks for the time to read this.
If you liked this post, please be sure to subscribe to my RSS Feed.