{"id":1112,"date":"2009-10-29T12:00:00","date_gmt":"2009-10-29T12:00:00","guid":{"rendered":"http:\/\/orcldoug.com\/blog\/?p=1112"},"modified":"2009-10-29T12:00:00","modified_gmt":"2009-10-29T12:00:00","slug":"10g-consolidated-trace-files-and-px","status":"publish","type":"post","link":"http:\/\/orcldoug.com\/blog\/2009\/10\/29\/10g-consolidated-trace-files-and-px\/","title":{"rendered":"10g Consolidated Trace Files and PX"},"content":{"rendered":"<p>At the end of my Tracing Parallel Execution presentation at the Scottish OUG conference, Michael M\u00f8ller of Miracle asked whether the consolidated trace files produced by the DBMS_MONITOR package and trcsess utility are in strict time order. i.e. Will I see the actions of the query coordinator, then the actions that the slaves perform on it&#8217;s behalf, then the qc acting on the results, then the slaves returning more results and so on. At the time, I hazarded a guess that they were (because that would sense) but said I would check properly.<\/p>\n<p>Because I&#8217;m only interested in functionality and not performance, the test can be a very small scale variation of the performance tests I&#8217;ve run previously. The test table contains half a million rows in 8K blocks leading to a 64Mb data segment. There are no indexes on the table. First, I set up the client_id and enable tracing at the session level.<\/p>\n<p><code><\/code><\/p>\n<pre>$ uname -a<br\/>SunOS ISP4400 5.10 Generic_118855-14 i86pc i386 i86pc<br\/>$ sqlplus testuser\/testuser;<br\/><br\/>SQL*Plus: Release 10.2.0.2.0 - Production on Sun Oct 29 13:28:55 2006<br\/><br\/>Copyright (c) 1982, 2005, Oracle.  All Rights Reserved.<br\/><br\/><br\/>Connected to:<br\/>Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production<br\/>With the Partitioning, OLAP and Data Mining options<br\/><br\/><br\/>SQL&gt; exec dbms_session.set_identifier('doug_test');<br\/><br\/>PL\/SQL procedure successfully completed.<br\/><br\/>SQL&gt; exec dbms_monitor.client_id_trace_enable(client_id =&gt; 'doug_test');<br\/><br\/>PL\/SQL procedure successfully completed.<\/pre>\n<p>Next I&#8217;ll force a simple parallel full table scan using parallel degree 2. My intention here is to simplify the resulting trace output as much as possible.<\/p>\n<p><code><\/code><\/p>\n<pre>SQL&gt; set timing on<br\/>SQL&gt; SELECT \/*+ parallel(tt1, 2) *\/    COUNT(*)<br\/>  2  FROM test_tab1 tt1<br\/>  3  \/<br\/><br\/>  COUNT(*)<br\/>----------<br\/>    512000<br\/><br\/>Elapsed: 00:00:00.80<br\/><br\/>SQL&gt; set timing off<\/pre>\n<p>Just a quick check that PX was used in this session.<\/p>\n<p><code><\/code><\/p>\n<pre>SQL&gt; SELECT dfo_number, tq_id, server_type, process, num_rows, bytes<br\/>  2  FROM v$pq_tqstat<br\/>  3  ORDER BY dfo_number DESC, tq_id, server_type DESC , process;<br\/><br\/>DFO_NUMBER      TQ_ID SERVER_TYPE<br\/>---------- ---------- ------------------------------<br\/>PROCESS                          NUM_ROWS      BYTES<br\/>------------------------------ ---------- ----------<br\/>         1          0 Producer<br\/>P000                                    1         32<br\/><br\/>         1          0 Producer<br\/>P001                                    1         32<br\/><br\/>         1          0 Consumer<br\/>QC                                      2         64<\/pre>\n<p>Oracle has produced three trace files. One in user_dump_dest for the query co-ordinator &#8230;<\/p>\n<p><code><\/code><\/p>\n<pre>$ cd \/oracle\/admin\/TEST1020\/udump<br\/>$ ls -ltra<br\/>total 676<br\/>drwxr-xr-x   7 oracle   oinstall     512 Oct  7 11:54 ..<br\/>drwxr-xr-x   2 oracle   oinstall    1536 Oct 29 13:29 .<br\/>-rw-r-----   1 oracle   oinstall   35340 Oct 29 13:36 test1020_ora_2663.trc<\/pre>\n<p>&#8230; and two in background_dump_dest for the two PX slaves &#8230;<\/p>\n<p><code><\/code><\/p>\n<pre><br\/><br\/>$ cd ..\/bdump<br\/>$ ls -ltra<br\/>total 3084<br\/>drwxr-xr-x   7 oracle   oinstall     512 Oct  7 11:54 ..<br\/>-rw-r--r--   1 oracle   oinstall  141715 Oct 29 12:43 alert_TEST1020.log<br\/>drwxr-xr-x   2 oracle   oinstall    2560 Oct 29 13:31 .<br\/>-rw-r-----   1 oracle   oinstall  562054 Oct 29 13:33 test1020_p000_2666.trc<br\/>-rw-r-----   1 oracle   oinstall  694551 Oct 29 13:33 test1020_p001_2668.trc<\/pre>\n<p>The next task is to generate the consolidated trace file that will include all of the actions for client_id doug_test from all three trace files.<\/p>\n<p><code><\/code><\/p>\n<pre>$ trcsess output=\"doug_test.trc\" clientid=\"doug_test\" \/oracle\/admin\/TEST1020\/udump\/*.trc \\ <br\/>\t\/oracle\/admin\/TEST1020\/bdump\/*.trc<br\/>$ ls -ltra doug_test.trc<br\/>-rw-r--r--   1 oracle   oinstall 1717274 Oct 29 13:40 doug_test.trc<\/pre>\n<p>Now to find out if the consolidated trace file is in strict time order. I&#8217;m going to snip out tons of inrellevant information and only look at the steps specific to the SELECT COUNT(*). The QC is first. I&#8217;ve highlighted the wall clock &#8216;tim&#8217; values<\/p>\n<p><code><\/code><\/p>\n<pre>PARSING IN CURSOR #8 len=138 dep=0 uid=27 oct=3 lid=27 <i><b>tim=88193242894<\/b><\/i> <br\/>\thv=1002038861 ad='918fe164'<br\/>SELECT \/*+ parallel(tt1, 2) *\/<br\/>-- MOD(tt1.pk_id, 2),<br\/>COUNT(*)<br\/>FROM test_tab3 tt1<br\/>-- GROUP BY MOD(tt1.pk_id,2)<br\/>-- ORDER BY MOD(tt1.pk_id,2)<br\/>END OF STMT<br\/>PARSE #8:c=170000,e=244171,p=9,cr=265,cu=3,mis=1,r=0,dep=0,og=1,<i><b>tim=88193242884<\/b><\/i><br\/>WAIT #8: nam='db file sequential read' ela= 14281 file#=6 block#=2236425 <br\/>\tblocks=1 obj#=10660 <i><b>tim=88193261507<\/b><\/i><br\/>WAIT #8: nam='PX Deq: Join ACK' ela= 2053 sleeptime\/senderid=268500992 <br\/>\tpasses=1 p3=0 obj#=10660 <i><b>tim=88193268968<\/b><\/i><br\/>WAIT #8: nam='PX Deq: Parse Reply' ela= 4 sleeptime\/senderid=200 <br\/>\tpasses=1 p3=0 obj#=10660 <i><b>tim=88193276000<\/b><\/i><br\/>WAIT #8: nam='PX Deq: Parse Reply' ela= 24043 sleeptime\/senderid=200 <br\/>\tpasses=2 p3=0 obj#=10660 <i><b>tim=88193300120<\/b><\/i><br\/>EXEC #8:c=20000,e=61590,p=1,cr=3,cu=0,mis=0,r=0,dep=0,og=1,<i><b>tim=88193304745<\/b><\/i><\/pre>\n<p>Next I&#8217;m going to skip over a large bunch of PX Execute Reply wait events that appear next, as the QC waits for results to be returned from the slave processes (which almost provides the answer to Michael&#8217;s question already), to take a look at the start of the slave activity.<\/p>\n<p><code><\/code><\/p>\n<pre>PARSING IN CURSOR #1 len=138 dep=1 uid=27 oct=3 lid=27 <i><b>tim=88193297955<\/b><\/i> <br\/>\thv=1002038861 ad='918fe164'<br\/>SELECT \/*+ parallel(tt1, 2) *\/<br\/>-- MOD(tt1.pk_id, 2),<br\/>COUNT(*)<br\/>FROM test_tab3 tt1<br\/>-- GROUP BY MOD(tt1.pk_id,2)<br\/>-- ORDER BY MOD(tt1.pk_id,2)<br\/>END OF STMT<br\/>PARSE #1:c=0,e=1948,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=1,<i><b>tim=88193297879<\/b><\/i><br\/>WAIT #1: nam='PX Deq: Execution Msg' ela= 2354 sleeptime\/senderid=268566527 <br\/>\tpasses=1 p3=0 obj#=-1 <i><b>tim=88193304777<\/b><\/i><\/pre>\n<p>I can see that this line from the QC <\/p>\n<p><code><\/code><\/p>\n<pre>WAIT #8: nam='PX Deq: Parse Reply' ela= 24043 sleeptime\/senderid=200 <br\/>\tpasses=2 p3=0 obj#=10660 <i><b>tim=88193300120<\/b><\/i><\/pre>\n<p>appears before this line from one of the slaves<\/p>\n<p><code><\/code><\/p>\n<pre>PARSE #1:c=0,e=1948,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=1,<i><b>tim=88193297879<\/b><\/i><\/pre>\n<p>&#8230; even though it happened at a later time.<\/p>\n<p>The simple answer is that trcsess does not consolidate the events into timed order rather, looking at <a href=\"http:\/\/oracledoug.com\/consolidated_trace.txt\">the consolidated trace file<\/a> (note that file is an unaltered section from the middle of the entire trace file), it groups together all of the actions related to a specific cursor which, in retrospect, makes much more sense even though it strikes me as being less interesting.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>At the end of my Tracing Parallel Execution presentation at the Scottish OUG conference, Michael M\u00f8ller of Miracle asked whether the consolidated trace files produced by the DBMS_MONITOR package and trcsess utility are in strict time order. i.e. Will I see the actions of the query coordinator, then the actions that the slaves perform on&hellip; <a class=\"more-link\" href=\"http:\/\/orcldoug.com\/blog\/2009\/10\/29\/10g-consolidated-trace-files-and-px\/\">Continue reading <span class=\"screen-reader-text\">10g Consolidated Trace Files and PX<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1112","post","type-post","status-publish","format-standard","hentry","category-uncategorized","entry"],"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":976,"url":"http:\/\/orcldoug.com\/blog\/2005\/05\/29\/px-slave-trace-files\/","url_meta":{"origin":1112,"position":0},"title":"PX Slave Trace Files","date":"May 29, 2005","format":false,"excerpt":"It's sad that it takes a Bank Holiday weekend for me to get round to doing some more research on parallel execution. Anyway, I was on the verge of modifying the following line from the PX paper ...The trace files for the slave processes may be created in background_dump_dest, rather\u2026","rel":"","context":"Similar post","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":967,"url":"http:\/\/orcldoug.com\/blog\/2005\/07\/25\/a-small-follow-up\/","url_meta":{"origin":1112,"position":1},"title":"A small follow-up","date":"July 25, 2005","format":false,"excerpt":"From a previous blog entry :-\"... I noticed that the slave trace files are appearing in user_dump_dest. This is with 9.2.0.1.0 on Windows XP Home. I'm using 9.2 because I want to see the discrete SQL statements that the slaves are processing. So, just an interesting anomaly from what I've\u2026","rel":"","context":"Similar post","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":854,"url":"http:\/\/orcldoug.com\/blog\/2006\/02\/27\/something-for-v2\/","url_meta":{"origin":1112,"position":2},"title":"Something for V2","date":"February 27, 2006","format":false,"excerpt":"This is mainly for anyone who has read the early versions of the Hotsos 'How Many Slaves' paper. It won't make as much sense if you haven't.I was doing some more work on multi-user tests at the weekend. I reduced the size of the tables to eliminate disk i\/o (as\u2026","rel":"","context":"Similar post","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1697,"url":"http:\/\/orcldoug.com\/blog\/2013\/03\/11\/not-all-deadlocks-are-created-the-same\/","url_meta":{"origin":1112,"position":3},"title":"Not all Deadlocks are created the same","date":"March 11, 2013","format":false,"excerpt":"I've blogged about deadlocks in Oracle at least once before. I said then that although the following message in deadlock trace files is usually true, it isn't always. The following deadlock is not an Oracle error. Deadlocks of\u00a0 this type can be expected if certain SQL statements are\u00a0\u00a0\u00a0\u00a0\u00a0 issued. The\u2026","rel":"","context":"Similar post","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1231,"url":"http:\/\/orcldoug.com\/blog\/2007\/03\/10\/how-can-i-tell-the-actual-dop-used-for-my-parallel-query\/","url_meta":{"origin":1112,"position":4},"title":"How can I tell the actual DOP used for my Parallel Query?","date":"March 10, 2007","format":false,"excerpt":"At the end of my presentation this week, when I asked for questions, a lady from the middle of the hall piped up to ask something along the lines of.\"How can I tell the actual DOP used for my Parallel Query?\" (or words to that effect)It was in the context\u2026","rel":"","context":"With 3 comments","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":840,"url":"http:\/\/orcldoug.com\/blog\/2006\/03\/08\/how-many-slaves\/","url_meta":{"origin":1112,"position":5},"title":"How Many Slaves?","date":"March 8, 2006","format":false,"excerpt":"Parallel Execution and the Magic of 2That's my second presentation, at 2:15 today. I've thought long and hard about this one and hope I've made the right decision. I was concerned about how to encapsulate a 50+ page paper into a one hour slot. I hate presentations which are full\u2026","rel":"","context":"With 5 comments","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/posts\/1112","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/comments?post=1112"}],"version-history":[{"count":0,"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/posts\/1112\/revisions"}],"wp:attachment":[{"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/media?parent=1112"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/categories?post=1112"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/tags?post=1112"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}