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.
Author |
Topic |
pesna
Starting Member
1 Post |
Posted - 2010-12-11 : 06:07:27
|
HiI’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 numbershift datetime – The date for the shift.ts datetime – TimeStamp for the eventand 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 KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Subscribe to my blog |
|
|
|
|
|