如何在不重复分片的情况下扩展数据库中的写入?
您将如何在不重复分片的情况下扩展写入(特别是使用 SQL Server 2008)?
How would you scale writings without recurring to sharding (specially with SQL Server 2008)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
通常......避免在大表中使用索引和外键。对索引列的每次插入/更新都意味着部分重建索引,有时这可能会非常昂贵。当然,您必须在查询速度与写入速度之间进行权衡,但这是数据库设计中的一个已知问题。您可以将其与具有某种缓存查询机制的 NoSQL 数据库结合起来。也许您的事务系统前面有一个快速的 NoSQL 系统。
另一种选择是使用事务以便一次性执行多次写入,当您提交事务时,索引将被重建,但每个事务仅重建一次,而不是每次写入一次。
Normally ... avoid indexes and foreign keys in big tables. Every insert/update on a indexed column implies rebuilding partially the index and sometimes this can be very costly. Of course, you'll have to trade query speed VS writing speed but this is a known issue in database design. You can combine this with a NoSQL database with a some sort of mechanism for caching queries. Maybe a fast NoSQL system sitting in front of your transactional system.
Another option is to use transactions in order to do many writes in one go, when you commit the transaction the indexes will be rebuilt but just once per transaction not one per write.
为什么不分片?通过使用透明的分片工具可以避免代码的复杂性,从而减轻与分片相关的所有繁重工作。
查看 ScaleBase 了解更多信息
Why not shard? The complexities in the code can be avoided by using transparent sharding tools, which ease all the heavy lifting associated with sharding.
Check out ScaleBase for more info