java - 如何存储映射表 - lucene 或 DB?

标签 java database indexing lucene

我想在 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/

相关文章:

sql - 同步客户端-服务器数据库

数据库服务器。为什么 [几乎] 任何类型的字段值都可以在查询/DML 中被视为带引号的字符串?

database - 尽管不需要使用它来唯一标识记录而不是我们有另一个唯一标识符,但在模型中使用 Id 属性是否更好?

search - 从主分片或副本中获取的文档

java - 根据未知数量的键对对象列表进行排序

java - 增加插入嵌入式文档 MONGODB 的计数器

java - 在单个后台线程定期修改 map 的同时读取 map

python - 此 numpy 数组索引的较短版本

mysql 7列pk与1列md5唯一约束

java - 不支持的媒体类型 - HTTP 状态 415