Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How should I log user activity

Author  Topic 

Keysle
Starting Member

15 Posts

Posted - 2010-10-07 : 22:47:40
How should I log user activity?
Should I have a table for each user or store it all in one?

http://Keysle.com
/* I am going to be on here a lot until I get my project done */

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-10-07 : 22:52:52
You should never have a table for each user. To store it all in one, just add a userid column.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

Keysle
Starting Member

15 Posts

Posted - 2010-10-07 : 23:04:56
Let's say I have 5 million users (1/10 of facebook)
How isn't that table going to get large fast?
Does that size threaten the site's delivery time?


Also, should I store the descriptions in the user general table?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-10-07 : 23:36:41
As long as you properly design the database, performance shouldn't be a concern. Indexes are very important.

5 million users is a small table these days. I've got over a billion rows stored in one table and don't have performance issues.

What's your hardware look like?

Can you give an example of the descriptions?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

Keysle
Starting Member

15 Posts

Posted - 2010-10-07 : 23:51:54
A description could be very long or very short.
I want the same flexibility as a facebook description.

I honestly don't know what my hardware looks like, 1and1 currently is hosting my site. (the site is not up yet)

http://Keysle.com
/* I am going to be on here a lot until I get my project done */
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-10-08 : 00:04:12
You may want to put that into a separate table. It just depends on the design of the user table and the indexes.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

Keysle
Starting Member

15 Posts

Posted - 2010-10-08 : 01:34:37
So the user activity could literally have 1 quadrillion entries and it won't slow down the system? Does the automatic partitioning help accomplish this?

http://Keysle.com
/* I am going to be on here a lot until I get my project done */
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-10-08 : 01:41:22
1 quadrillion entries will certainly slow down the system.

But I highly doubt you have a system like this.

Look into table partitioning for how to handle large tables (1 billion+).

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

Keysle
Starting Member

15 Posts

Posted - 2010-10-08 : 01:52:51
Do you think that's how facebook does it?

http://Keysle.com
/* I am going to be on here a lot until I get my project done */
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-10-08 : 01:59:05
Facebook isn't using SQL Server. I am not sure how their system is designed.

I know that MySpace is using SQL Server, but they took a completely different route. They've split their system into thousands of databases spread across thousands of servers. I'm not joking either. I went to a presentation last year regarding their architecture.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

Keysle
Starting Member

15 Posts

Posted - 2010-10-08 : 02:05:37
Myspace is kind of slow. Do you think it's because of their architecture?

Youtube uses SQL and they keep activity logs (though I'm not sure how long those logs run for)
I will worry about activity logs later. I'm not sure people are all that hyped to have them quite yet

http://Keysle.com
/* I am going to be on here a lot until I get my project done */
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-10-08 : 02:10:51
I can't comment on why their site is so slow. I stopped using it a while ago.

I don't think there's a single system that has a quadrillion rows in it, so I doubt you will have a system like this.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

Keysle
Starting Member

15 Posts

Posted - 2010-10-08 : 02:14:57
@"I don't think there's a single system that has a quadrillion rows in it"

Facebook keeps logs they have 500 million users. I'm sure they've got a couple thousand logs on some people.
I'll worry about how they do it later.

http://Keysle.com
/* I am going to be on here a lot until I get my project done */
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-10-08 : 13:28:49
I can guarantee you that they don't have a quadrillion rows in a single table. They'll have it split out somehow.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -