我想在 id
和两个文本属性之间存储大型映射表。
数据集将多达 100 万个条目,并且每天刷新。
您是否愿意通过该 ID 创建 lucene
索引和索引表?或者创建一个以 id 作为主键的 database
(postgres) 表?甚至不同的解决方案?
为什么人们更喜欢这两种解决方案?
我只想按ID查找,不想反向查找。映射表应该很简单:输入一个id,返回两个字符串属性。
最佳答案
您要找的似乎是 Key-value store (wikipedia article)
Key-value (KV) stores use the associative array (also known as a map or dictionary) as their fundamental data model. In this model, data is represented as a collection of key-value pairs, such that each possible key appears at most once in the collection.
The key-value model is one of the simplest non-trivial data models, and richer data models are often implemented on top of it. The key-value model can be extended to an ordered model that maintains keys in lexicographic order. This extension is powerful, in that it can efficiently process key ranges.
Key-value stores can use consistency models ranging from eventual consistency to serializability. Some support ordering of keys. Some maintain data in memory (RAM), while others employ solid-state drives or rotating disks.
那里的文章还提供了相当完整的可用实现列表。不幸的是,我无法向您推荐其中一种实现方式,因为我没有在生产中使用过其中任何一种。但我坚信谷歌充满了键值存储的比较。
为了回答您的问题,我不会选择 Lucene,因为它是一个开源信息检索软件库,旨在实现信息检索应用程序。您要做的是不会触及 Lucene 的最佳位置。
经典的 RDBMS 更接近您的要求。但如上所述,键值存储可以解决问题。
关于java - 如何存储映射表 - lucene 或 DB?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27984093/