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

后端 未结 3 690
眼角桃花
眼角桃花 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:46

    From the code you give, I really don't think tmp tables are needed, nor is FULLTEXT searching. But ... about tmp table performance:

    The creation/cleanup of the tmp table is not written to transaction logs, so it will be relatively quick for the OS to do the I/O involved. If the temporary tables will be small and short-lived, and you have lots of buffers available for the OS, the disk realistically wont even be touched. If you think it will be anyways, get an SSD drive, and get more RAM.

    But if you are realistic that you are looking at hundreds of thousands of searches per second then you have a big engineering project on hand. Why not just do:

    select images.* from images where name in ('some', 'search', 'query')

    ?

提交回复
热议问题