对于您提到的数字,我认为所有替代方案都应该有效(阅读:您将能够在合理的时间内完成分析)。我推荐一种可以带来明显更快结果的设计。
如前所述,通常 postgresql 比 mongo 快,有时快 4 倍以上。
例如看这个。
您说您对提高连接性能感兴趣。我假设您对计算实体之间的相似性(例如,帖子、作者)感兴趣,因此您主要将表格与其自身(例如,通过帖子或作者)连接并聚合。
除此之外,在初始加载后您的数据库将是只读的,这使得该问题非常适合索引使用。您不会为索引更新付费,因为您没有任何索引,而且我猜您有额外的索引存储空间。
我会使用 postgres 并将数据存储在两个表中:
创建表posts(post_id整数,url varchar(255),author_id整数);
-- 加载数据,然后创建索引。-- 这将导致更快的加载和更好的索引更改表帖子添加约束posts_pk主键(post_id);在帖子上创建索引 post_author(author_id);
创建表comments(comment_id integer, post_id integer, author_id integer, comment varchar(255)) ; alter table comments 添加约束 comments_pk 主键(comment_id); 在评论上创建索引comment_author(author_id);在评论(post_id)上创建索引comment_post;
然后,您可以根据 select m 等查询中的评论计算作者相似度。author_id 为 m_author_id,a。author_id as a_author_id,count(distinct m.post_id) as posts from comments as m join comments as a using (post_id) group by m.author_id,a。author_id
如果您有兴趣对 nlp 评论中的单词进行标记,请为此添加另一个表,但请记住,它会显着增加您的数据量。通常最好不要在数据库中表示整个标记化。