这个问题在这里已有答案:
如何最好地处理历史数据的存储? 2个答案将过去的数据保存在数据库中的最佳做法是什么? 例如,假设我们在工资核算解决方案中有交易表,如AttendanceTrans , SalaryTrans 。 因此,每个月我们都必须向这些表中插入数百或数千条新记录。 所以所有过去和当前数据都在同一个表中。
另一种方法是保持AttendanceHistory和SalaryHistory表。 因此,在将每个句点(月)结束后,我们会在将数据复制到各个历史记录表后清空Trans表。
在考虑性能,易于生成报告,易于编码和维护等因素时,最佳解决方案是什么?
注意 :RDBMS是SQL Server 2008,编程环境是.NET(C#)
This question already has an answer here:
How to best handle the storage of historical data? 2 answersWhat is the best practice of keeping past data in the database? For example lets say we have transaction tables like AttendanceTrans, SalaryTrans in a payroll solution. So every month we have to insert hundreds or thousands of new records to these tables. So all the past and current data in same table.
Another approach would be to keep AttendanceHistory and SalaryHistory tables. So that end of every period (month) we empty the Trans tables after coping the data to respective History tables.
When considering factors like performance, ease of report generation, ease of coding and maintenance, what would be the optimum solution?
Note : RDBMS is SQL Server 2008 and programming environment is .NET (C#)
最满意答案
通常,您应该将所有数据保存在同一个表中。 SQL Server非常适合处理大量数据,如果它们都在一个地方,它将使您的生活变得更加轻松(报告,查询,编码,维护)。 如果您的数据被正确编入索引,那么您每月可以获得数千条新记录。
In general you should keep all the data in the same table. SQL Server is great at handling large volumes of data and it will make your life a lot easier (reporting, querying, coding, maintenance) if it's all in one place. If your data is indexed appropriately then you'll be just fine with thousands of new records per month.
将历史数据保存在数据库中[重复](Keeping historical data in the database [duplicate])这个问题在这里已有答案:
如何最好地处理历史数据的存储? 2个答案将过去的数据保存在数据库中的最佳做法是什么? 例如,假设我们在工资核算解决方案中有交易表,如AttendanceTrans , SalaryTrans 。 因此,每个月我们都必须向这些表中插入数百或数千条新记录。 所以所有过去和当前数据都在同一个表中。
另一种方法是保持AttendanceHistory和SalaryHistory表。 因此,在将每个句点(月)结束后,我们会在将数据复制到各个历史记录表后清空Trans表。
在考虑性能,易于生成报告,易于编码和维护等因素时,最佳解决方案是什么?
注意 :RDBMS是SQL Server 2008,编程环境是.NET(C#)
This question already has an answer here:
How to best handle the storage of historical data? 2 answersWhat is the best practice of keeping past data in the database? For example lets say we have transaction tables like AttendanceTrans, SalaryTrans in a payroll solution. So every month we have to insert hundreds or thousands of new records to these tables. So all the past and current data in same table.
Another approach would be to keep AttendanceHistory and SalaryHistory tables. So that end of every period (month) we empty the Trans tables after coping the data to respective History tables.
When considering factors like performance, ease of report generation, ease of coding and maintenance, what would be the optimum solution?
Note : RDBMS is SQL Server 2008 and programming environment is .NET (C#)
最满意答案
通常,您应该将所有数据保存在同一个表中。 SQL Server非常适合处理大量数据,如果它们都在一个地方,它将使您的生活变得更加轻松(报告,查询,编码,维护)。 如果您的数据被正确编入索引,那么您每月可以获得数千条新记录。
In general you should keep all the data in the same table. SQL Server is great at handling large volumes of data and it will make your life a lot easier (reporting, querying, coding, maintenance) if it's all in one place. If your data is indexed appropriately then you'll be just fine with thousands of new records per month.
发布评论