From a performance perspective, how efficient is it to use a MySQL temporary table for a highly used website feature?

后端 未结 3 680
眼角桃花
眼角桃花 2021-02-14 03:48

I\'m attempting to write a search functionality for a website, and I\'ve decided upon an approach of using MySQL temporary tables to handle the data input, via the query below:<

3条回答
  •  一生所求
    2021-02-14 04:39

    1. Creating temporary tables on disk is relatively expensive. In your scenario it sounds like it'll be slower than it's worth.
    2. It's usually only worthwhile to create temporary tables in memory. But you need to know you have enough memory available at all times. If you plan to support so many searches per second this is not a good solution.
    3. MySQL has full-text searching built-in. It's good for small systems. This would likely perform far better than your temp table and JOIN. But if you want to support thousands of searches per second I would not recommend it. It could consume too much of your overall database performance. Plus you're then forced to use MyISAM for storage which might have its own issues in your scenario.
    4. For so many searches you'll want to offload the work to another system. Plenty of searching systems with scoring already exist. Take a look at ElasticSearch, Solr/Lucene, Redis, etc.

提交回复
热议问题