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

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

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

    求问 v 友有什么好的办法

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