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
 Database Design and Application Architecture
 One table or?

Author  Topic 

pesna
Starting Member

1 Post

Posted - 2010-12-11 : 06:07:27
Hi

I’m working on a school project where some servers (placed at different companies) are going to upload logs to a central server for statistical purposes. At the moment all log entries goes in the same table at the central server.

The table at the central server has:

customerID varchar(12) – the different companies
pno varchar(150) – person identification number
shift datetime – The date for the shift.
ts datetime – TimeStamp for the event
and other varchars describing different things.

I have not set any primary keys – but the customerID is a foreign key. Is SQL Server (we use SQL server 2008 express) setting a clustered index by itself at one of the fields?? And should I have a primary key?

I was thinking about making a table for each customer instead. And when setting a clustered index at the TimeStamp – would that be a better idea?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-12-11 : 13:52:03
SQL Server is not adding a clustered index for you. If you were to add a PK, then you do get an index on it and the default is clustered.

Yes you should have a primary key! And please add a clustered index too, either on the PK or another column or set of columns (make it narrow)!

I would not advise on creating a table for each customer. We support hundreds/thousands of customers and stored them all in the same tables. You can choose to partition your table, but that would really depend on how much data you are going to have.

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 -