aidevs
V2EX  ›  问与答

如何做搜索的性能优化?

  •  
  •   aidevs · Aug 20, 2015 · 1430 views
    This topic created in 3920 days ago, the information mentioned may be changed or developed.
    数据表结构

    [product] 产品表 (数据有 20 万行)
    id

    name 产品名称
    pinyin 产品拼音

    hot 产品热度(用于排序)
    .....



    现在要搜索 “短袖” 数据库中包含短袖的 记录有 900 多行,现在要分页显示

    每天搜索用户有 100 多万,怎么去做呢?用什么技术去做呢?

    我按照传统 sql 去写,发现数据库 cpu ( 2xcpu L5520 ) 快彪到 60%


    我想到的方法:

    1 、记录用户经常搜索的关键字和频率
    2 、根据用户经常搜索这些关键字,找出前 N 个关键字,提前建立搜索结果,
    再有用户去搜索这 N 个关键字的时候,直接展示结果


    我觉得这种方法很笨,有没有更加高效的方法?
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   4523 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 167ms · UTC 10:06 · PVG 18:06 · LAX 03:06 · JFK 06:06
    ♥ Do have faith in what you're doing.