• 请不要在回答技术问题时复制粘贴 AI 生成的内容
simonlu9
V2EX  ›  程序员

社交共同好友要怎么现在比较好,现在想到用 neo4j 实现,成本有点大

  •  
  •   simonlu9 · Nov 2, 2021 · 2578 views
    This topic created in 1855 days ago, the information mentioned may be changed or developed.

    求问 v 友有什么好的办法

    7 replies  •  2022-02-07 16:13:45 +08:00
    xuanbg
    xuanbg
    Nov 3, 2021
    1
    共同好友不是一句 sql 就查出来了吗? select friend_id, friend_name from relation_table where user_id in (xxx, yyy) group by friend_id having count(*) > 1;
    AmaQuinton
    AmaQuinton
    Nov 3, 2021
    2
    用 redis 实现
    simonlu9
    simonlu9
    OP
    Nov 3, 2021
    3
    @xuanbg 不是查一个人,要查多个人
    xuanbg
    xuanbg
    Nov 3, 2021
    4
    共同好友不就是 xxx 和 yyy 的好友的交集吗?
    x940727
    x940727
    Nov 3, 2021
    5
    一楼正解,既是 A 的好友又是 B 的好友就是共同好友了。
    strawberryBug
    strawberryBug
    Nov 3, 2021
    6
    图数据库查询多度好友很快的
    shinyzhu
    shinyzhu
    Feb 7, 2022
    7
    说说用 Neo4j 的成本在哪里?感兴趣:)
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2790 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 113ms · UTC 05:08 · PVG 13:08 · LAX 21:08 · JFK 00:08
    ♥ Do have faith in what you're doing.