In this scenario, every sales order is going to have atleast 400-500 products associated with it. Now everytime a sales order is generated, the cost and price of those products will be saved in the SalesOrderProduct table. This will cause the SalesOrderProduct table to become extremely large in a short period of time. Whats the best way to handle the size of this table?
在这种情况下,每个销售订单将至少有400-500个与之相关的产品。现在每次生成一个销售订单时,这些产品的成本和价格将保存在SalesOrderProduct表中。这将导致SalesOrderProduct表在短时间内变得非常大。处理这张桌子的大小最好的方法是什么?
1 个解决方案
#1
3
Are you sure there is a problem?
你确定有问题吗?
If you have millions of rows, no sweat. A SQL database will chew that stuff up.
如果你有数百万行,就不用担心。SQL数据库会对这些东西进行分析。
If you have billions of rows, you might want a key-value store instead of a SQL database. Especially for archival information like past orders which is write-once read-never (and analyze-rarely). If you can't switch from SQL, you can use a clustered database.
如果您有数十亿行,您可能需要一个键值存储而不是SQL数据库。特别是对于像过去的订单这样的存档信息,它是写一次读——不读(而且很少分析)。如果不能从SQL切换,可以使用集群数据库。
But before you do anything, be sure there's an issue - test the performance with a good, realistic workload. See if it'll handle your needs for the near future. Don't solve problems which aren't there.
但是在您做任何事情之前,请确保存在一个问题——使用一个良好的、真实的工作负载测试性能。看看它是否能满足你近期的需求。不要解决不存在的问题。
Final note: for this particular database schema, you can eliminate the SalesOrderProduct table by keeping track of historical costs/prices for products. Then you can use the order date to backfigure the costs/prices of all ordered products, eliminating the need for that join table.
最后注意:对于这个特定的数据库模式,您可以通过跟踪产品的历史成本/价格来消除SalesOrderProduct表。然后,您可以使用订单日期来回溯所有订购产品的成本/价格,从而消除了对联接表的需求。
#1
3
Are you sure there is a problem?
你确定有问题吗?
If you have millions of rows, no sweat. A SQL database will chew that stuff up.
如果你有数百万行,就不用担心。SQL数据库会对这些东西进行分析。
If you have billions of rows, you might want a key-value store instead of a SQL database. Especially for archival information like past orders which is write-once read-never (and analyze-rarely). If you can't switch from SQL, you can use a clustered database.
如果您有数十亿行,您可能需要一个键值存储而不是SQL数据库。特别是对于像过去的订单这样的存档信息,它是写一次读——不读(而且很少分析)。如果不能从SQL切换,可以使用集群数据库。
But before you do anything, be sure there's an issue - test the performance with a good, realistic workload. See if it'll handle your needs for the near future. Don't solve problems which aren't there.
但是在您做任何事情之前,请确保存在一个问题——使用一个良好的、真实的工作负载测试性能。看看它是否能满足你近期的需求。不要解决不存在的问题。
Final note: for this particular database schema, you can eliminate the SalesOrderProduct table by keeping track of historical costs/prices for products. Then you can use the order date to backfigure the costs/prices of all ordered products, eliminating the need for that join table.
最后注意:对于这个特定的数据库模式,您可以通过跟踪产品的历史成本/价格来消除SalesOrderProduct表。然后,您可以使用订单日期来回溯所有订购产品的成本/价格,从而消除了对联接表的需求。