Most efficient way to search in SQL?

前端 未结 7 1994

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:29

    A few pointers: Drop the * in your select statement and pull only the searched criteria, and make sure to add indexes to the columns that are getting searched.

    SELECT `title`,`description` 
    FROM `table` 
    WHERE `title` LIKE '%$searchterm%' OR `description` LIKE '%$searchterm%' LIMIT 25;
    

提交回复
热议问题