1

大数据量下数据判重,有什么好的方法?

 2 years ago
source link: https://www.v2ex.com/t/838980
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

V2EX  ›  程序员

大数据量下数据判重,有什么好的方法?

  leebs · 16 小时 53 分钟前 · 827 次点击

几十亿数据,提交一条数据,判断字段内容是否重复。 直接加索引,怕几十亿数据撑不住。

14 条回复    2022-03-09 10:50:24 +08:00

ericls

ericls      16 小时 47 分钟前 via iPhone

benchmark 了吗?

BrettD

BrettD      16 小时 44 分钟前   ❤️ 1

bloom filter

kera0a

kera0a      16 小时 43 分钟前 via iPhone   ❤️ 1

布隆过滤器,但会有一点点误判率。
误判率越小占用内存越大,速度非常快 O(1)

wellsc

wellsc      16 小时 42 分钟前

文本段?分词+倒排索引

leebs

leebs      16 小时 19 分钟前

@kera0a 布隆的空间占用情况呢,几十亿数据不会内存都放不下了吧。

levelworm

levelworm      16 小时 14 分钟前 via Android

不用全部对比吧,如果是分布式的话。更怕的是技术上不重但是业务上重。

levelworm

levelworm      15 小时 51 分钟前 via Android

对了,op 用的是什么数据库呐?

LeeReamond

LeeReamond      9 小时 23 分钟前

@kera0a 布隆过滤器一个问题是无法应对动态数据,实际业务里比如原先拦截 1 ,2 ,3 ,结果第二天业务上 2 从列表里删除了,布隆过滤器就比较吃瘪了

murmur

murmur      8 小时 14 分钟前

几十亿数据有分表或者分库么

leebs

leebs      7 小时 16 分钟前

@levelworm mongodb

shawndev

shawndev      6 小时 8 分钟前

Cuckoo Filter?

ElmerZhang

ElmerZhang      5 小时 45 分钟前

分表+唯一索引

ElmerZhang

ElmerZhang      5 小时 41 分钟前

当前表不好拆的话,就专门为这个索引建个新表,给这个表分表+唯一索引。
写数据的时候用事务,两个表一起写。
另外,你只是担心抗不住,到底抗不抗得住还是要看压测,说不定就抗得住了呢。不过这么大的表改索引也得费点劲。

kera0a

kera0a      5 小时 40 分钟前

@leebs 空间复杂度根据误判率来计算的
50 亿数据,误判率 0.001 大概需要 8G 内存

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK