对于战略之一到许多类型关联,其中&QUOT的;许多"侧条目百万 [英] Strategies for One-to-Many type of association where "many" side entries are in millions

查看:163
本文介绍了对于战略之一到许多类型关联,其中&QUOT的;许多"侧条目百万的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

给予一个比喻:微像场景,其中在一个人可以跟着人大量(一到多),

Giving an analogy: Twitter like scenario where in a person can be followed by huge number of people (one-to-many) ,

这是我能想到的几个选项

Few options which I could think of


  1. 使用某些OR映射工具,延迟加载。但是,当你访问关系的追随者的一面,它仍然会加载所有的数据,即使艰难懒洋洋地。所以不是一个合适的选择。

  1. Use some OR mapping tool with lazy loading. But when you access the "followers" side of relations, it will still load all the data even tough lazily. So not a suitable option.

别保持的一对多的关系(或不使用任何OR映射)。在获取单独调用的关注者的一面,并以编程处理分页等。

Do not maintain one-to-many relation (or not use any OR mapping) . Fetch the "Followers" side in separate call and handle the paging etc programmatically.

大数据到一些搜索栈(Lucene的/ Solr的),它可以更好地处理大量数据的卸载抓取。但是,这会引入数据库更新和索引更新之间的一些延迟。

Offload Fetching of large data to some search stack (Lucene/Solr) which can better handle large data. But this will introduce some latency between database update and index update.

请分享你的想法/建议和任何可能的工具库。堆栈包含的Java,MySQL的的。

Please share your thoughts/suggestions and any possible tools library. Stack consists of Java , MySQL.

推荐答案

百万应该不是一个问题,因为它是专为那些情况的RDBMS。

Millions should not be a problem for an RDBMS as it is designed for those situations.

有时还建议非规范化,而不是归优化应用程序的性能。这是专门为那些非常高的阅读应用程序和极低的写数据。

Sometimes it is also recommended to denormalize rather than normalize to optimize the performance of your application. This is specifically for applications that have very high read and very low write statistics.

这篇关于对于战略之一到许多类型关联,其中&QUOT的;许多"侧条目百万的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆