Friday, March 6, 2009

[13] Clarity SQL Trace Tip

Clarity SQL Trace thing I often do and mostly to know which Query is performing badly and eating up most chunk of Execution time... For short SQL Trace files it's easy to locate but for some when file runs over 400 kb or so then Grrrrr..... Keep scrolling and scrolling..


Here is tip that can you use to avoid those 'scrolls' ... I use Textpad ( though you can use others ones too that support Regular Expression search ) for searching the SQL's that takes longer time. In Textpad check "Regular Expressions" and search for Time: [0-9][0-9][0-9][0-9] This will highlight the ones which takes over 1 sec, if you want to locate the ones which takes over 10 seconds then add another [0-9] in above expression.

2 comments:

  1. Hello again,

    You are certainly right in saying the it is a pain to locate the spot you are after in the trace.

    What I've tried is to copy the URL just before interesting page, log out, flush browser cache,
    paste the URL, set the trace on, hit enter on the browser to go to the saved URL page, login as required, go to the interesting page, log out.
    That way what you are looking is near the end.

    Granted the file can still be large.

    Textpad seems to have the advantage of highlighting over notepad2 which comes with some of the Windowses. I'll think I'll switch over.

    One challenge I have with the traces is when I am looking for a field that is displayed in the GUI, but which is a virtual field and not a database field. In that case you cannot find a match between object attributes field definition and a field used in the query. However, I'd still like to find the query or point which produces the data to the view. Looking at the fields used I might get an understanding of the of the principle and data range which would help
    on deciding on the question which brought that up.

    Even if the point in the trace is near the end sometimes it is difficult for a nonexpert on database and Clarity datamodel to pick it if there is a reference to XBl or java.

    Have you come across that and woul you have any thoughts what would make it easier?

    With regards

    Martti K.

    ReplyDelete
  2. Back before 13 it was possible to remove the trace file. Since the tracing action generates the file it doesn't matter if tracing is appending an existing file or creating a new one.
    So I'd turn on Tracing, log in browse to wherever in Clarity then go to the logs directory and remove the trace file. Then the only thing in the file would be the very next thing I did, as was said this can still be huge but at least you know that only the stuff you care about is in the file.

    ReplyDelete