When does Elk use tmp tables?
Part of my sql tuning strategy includes using a tmpfs ramdisk for mysql tmp tables. These have been increased slowly over time. It seems two things occur regarding tmp tables. One is it isn't yet large enough at 100M. The other is, and this could be erroneous, it appears they are seldom used.
The question is what/where/when does Elk use tmp tables? The answer could confirm the aforementioned erroneous potential. Or it could alter the tuning strategy. If it is indeed rarely used perhaps it's best to recoup the memory and let it go to hard disk instead.
Thoughts, insight, or feelings from the gurus?
Re: When does Elk use tmp tables?
Reply #1 –
Hummmm, I'll take a shot.
First up is the deliberate use of a temp table in the code CREATE TEMPORAY TABLE is pretty rare, mostly since not all sites allow (give the db privileges') to create them. So where they are used, non temporary table code also has to be added so things work everywhere. Which means extra work when doing any debugging or updates.
I can only think of a few areas where we try to use them. One is during search (custom and standard only I *think*), there is one in the maintance functions with recounting user posts, and then the "big" one was used in recent posts.
In 1.1.7 the recent posts one was removed (same for 2.0), and in 2.0 additionally the recounting maintance function was changed to avoid this. That leaves certain search indexes only in 2.0
Next up is the db engine deciding it needs some temporary tables to hold some intermediate data or etc, These are Internal temporary tables . Those as best as possible are worked around by how query's are constructed or tables / keys are created, but some are unavoidable but we do our best to avoid that, especially in any area under common use. Other areas, such as the ACP are run once every XX days so not as important.
I know doing things with DISTINCT like COUNT(DISTINCT) will do it, as will ORDER BY with a different GROUP BY clause, its these "sorting" of results that make the db engine go, hey I'll stuff these here and then sort them later. Being able to do that in memory is better then writing it to disk and you may be able to avoid that with your my.cnf settings.
Re: When does Elk use tmp tables?
Reply #3 –
When 1.1.7 is "done" that will get one major use. As for search consider sphinx instead, its somethign to play with (and if you do this I've recently done some research (RTFM) and improved whats in the 1.1 branch)
Re: When does Elk use tmp tables?
Reply #5 –
Could you expand a bit on what you mean by ' decimal indexing and results'