Most efficient way to search in SQL?

前端 未结 7 1998

I have a database with 75,000+ rows with 500+ entries added per day.

Each row has a title and description.

I created an RSS feed which gives you the latest entri

7条回答
  •  灰色年华
    2021-02-08 08:42

    I would go with JohnB's or gtr32x's answer (Full Text Indexing). To complement their answer, there's a manual way to create a simple full text index that's simple and it's super fast...

    Split title and description into keywords, and place them in a Keywords table, which has a foreign key to the original RSS article. Make sure the keyword column in Keywords is indexed. The you can do something like:

    SELECT DISTINCT ra.* 
    FROM RssArticle ra
    INNER JOIN Keywords k ON k.ArticleID = ra.ArticleID
       WHERE k IN ( 'SearchTerm1', 'SearchTerm2', 'SearchTerm3')
    LIMIT 20;
    

    And it's fast!

提交回复
热议问题