Note that there are some explanatory texts on larger screens.

plurals
  1. POProfiling Mnesia Queries
    primarykey
    data
    text
    <p>Our Mnesia DB is running slowly and we think it should be somewhat faster. </p> <p>So we need to profile it and work out what is happening.</p> <p>There are a number of options that suggest themselves:</p> <ul> <li>run fprof and see where the time is going</li> <li>run cprof and see which functions are called a lot</li> </ul> <p>However these are both fairly standard performance monitoring style tools. The question is how do I actually do query profiling - which queries are taking the longest times. If we were an Oracle or MySQL shop we would just run a query profiler which would return the sorts of queries that were taking a long time to run. This is not a tool that appears to be available for Mnesia.</p> <p>So the question is:</p> <ul> <li>what techniques exist to profile Mnesia</li> <li>what tools exist to profile Mnesia - none I think, but prove me wrong :)</li> <li>how did you profile your queries and optimise your mnesia database installation</li> </ul> <h2>Expanded In The Light Of Discussion</h2> <p>One of the problems with fprof as a profiling tool is that it only tells you about the particular query you are looking at. So fprof tells me that X is slow and I tweak it down to speed it up. Then, low and behold, operation Y (which was fast enough) is now dog slow. So I profile up Y and realise that the way to make Y quick is to make X slow. So I end up doing a series of bilateral trade-offs...</p> <p>What I actually <strong>need</strong> is a way to manage multilateral trade-offs. I now have 2 metric shed-loads of actual user activities logged which I can replay. These logs represent what I would like to optimize.</p> <p>A 'proper' query analyser on an SQL database would be able to profile the structure of SQL statements, eg all statements with the form: </p> <pre><code>SELECT [fieldset] FROM [table] WHERE {field = *parameter*}, {field = *parameter*} </code></pre> <p>and say <em>285 queries of this form took on average 0.37ms to run</em></p> <p>They magic answers are when it says: <em>17 queries of this form took 6.34s to run and did a full table scan on table X, you should put an index on field Y</em></p> <p>When I have a result set like this over a representative set of user-activities I can then start to reason about trade-offs in the round - and design a test pattern.</p> <p>The test pattern would be something like:</p> <ul> <li>activity X would make queries A, C and C faster but queries E and F slower</li> <li>test and measure</li> <li>then approve/disapprove</li> </ul> <p>I have been using Erlang long enough to 'know' that there is no query analyser like this, what I would like to know is how other people (who must have had this problem) 'reason' about mnesia optimization.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload