MySQL FULLTEXT Search Across >1 Table

后端 未结 4 1675
醉话见心
醉话见心 2020-12-18 10:18

As a more general case of this question because I think it may be of interest to more people...What\'s the best way to perform a fulltext search on two tables? Assume there

4条回答
  •  一整个雨季
    2020-12-18 10:40

    Just in case you don't know: MySQL has a built in statement called EXPLAIN that can be used to see what's going on under the surface. There's a lot of articles about this, so I won't be going into any detail, but for each table it provides an estimate for the number of rows it will need to process. If you look at the "rows" column in the EXPLAIN result for the second query you'll probably see that the number of rows is quite large, and certainly a lot larger than from the first one.

    The net is full of warnings about using subqueries in MySQL, but it turns out that many times the developer is smarter than the MySQL optimizer. Filtering results in some manner before joining can cause major performance boosts in many cases.

提交回复
热议问题