URGENT HELP about 'duration' stats - Mailing list pgsql-hackers

From Camilo Porto
Subject URGENT HELP about 'duration' stats
Date
Msg-id BLU111-W521DC75D94C33D2F5034C0BC970@phx.gbl
Whole thread Raw
Responses Re: URGENT HELP about 'duration' stats
Re: URGENT HELP about 'duration' stats
List pgsql-hackers
<div style="text-align: left;"><span class="q">Hi,<br /><br /></span>I have been doing my master degree research  and 
Iam using Postgresql 8.2.5. I would appreciate if anyone could help me, ASAP, concerning the following question: <br
/><br/>How can I obtain the time spent by the Postgresql  EXECUTOR  during a given time interval? <br /> <br />I am
tryingto get the above information in the following way::<br /> <br />Using the BenchmarkSQL Software, I submit random
transactions(by simulating the TPC-C benchmark) during a time interval (say 30 seconds). <br /><br />PostgreSQL then
generatesstatistics for each phase that a SQL Command is executed. In thje following, it is shown the time duration of
theEXECUTE Phase of some SQL Command:<span class="q"><br /> <br />.<br />.<br />.<br />.<br />2007-10-11 15:49: 05.221
BRT[46994] LOG:  duration: 0.012 ms  execute S_1: BEGIN<br />2007-10-11 15:49:05.430 BRT [46994] LOG:  duration: 94.073
ms execute <unnamed>: SELECT c_discount, c_last, c_credit, w_tax  FROM customer, warehouse WHERE <br /> w_id = $1
ANDw_id = c_w_id AND c_d_id = $2 AND c_id = $3 <br />2007-10-11 15:49:05.462 BRT [46994] LOG:  duration: 13.662 ms 
execute<unnamed>: SELECT d_next_o_id, d_tax FROM district WHERE d_id = $1 AND d_w_id = $2 FO <br />R UPDATE<br
/>2007-10-1115:49:05.562 BRT [46994] LOG:  duration: 98.818 ms  execute <unnamed>: INSERT INTO NEW_ORDER
(no_o_id,no_d_id, no_w_id) VALUES ( $1, $2, $3)<br />2007-10-11 15:49:05.579 BRT [46994] LOG:  duration: 15.459 ms 
execute<unnamed>: UPDATE district SET d_next_o_id = d_next_o_id + 1  WHERE d_id = $1 AND d_w <br />_id = $2<br
/>2007-10-1115:49:05.748 BRT [46994] LOG:  duration: 122.387 ms  execute <unnamed>: INSERT INTO OORDER  (o_id,
o_d_id,o_w_id, o_c_id, o_entry_d, o_ol_cnt, o <br />_all_local) VALUES ($1, $2, $3, $4, $5, $6, $7) <br />2007-10-11
15:49:05.779BRT [46994] LOG:  duration: 29.787 ms  execute <unnamed>: SELECT i_price, i_name , i_data FROM item
WHEREi_id = $1<br />2007-10-11 15:49: 05.846 BRT [46994] LOG:  duration: 64.963 ms  execute <unnamed>: SELECT
s_quantity,s_data, s_dist_01, s_dist_02, s_dist_03, s_dist_04, s_d <br />ist_05,        s_dist_06, s_dist_07,
s_dist_08,s_dist_09, s_dist_10 FROM stock WHERE s_i_id = $1 AND s_w_id = $2 FOR UPDATE <br />2007-10-11 15:49:05.882
BRT[46994] LOG:  duration: 33.865 ms  execute <unnamed>: SELECT i_price, i_name , i_data FROM item WHERE i_id =
$1<br />2007-10-11 15:49:05.931 BRT [46994] LOG:  duration: 48.075 ms  execute <unnamed>: SELECT s_quantity,
s_data,s_dist_01, s_dist_02, s_dist_03, s_dist_04, s_d <br />ist_05,        s_dist_06, s_dist_07, s_dist_08, s_dist_09,
s_dist_10FROM stock WHERE s_i_id = $1 AND s_w_id = $2 FOR UPDATE <br />2007-10-11 15:49:05.962 BRT [46994] LOG: 
duration:28.782 ms  execute <unnamed>: SELECT i_price, i_name , i_data FROM item WHERE i_id = $1 <br />2007-10-11
15:49:06.002BRT [46994] LOG:  duration: 38.026 ms  execute <unnamed>: SELECT s_quantity, s_data, s_dist_01,
s_dist_02,s_dist_03, s_dist_04, s_d <br />ist_05,        s_dist_06, s_dist_07, s_dist_08, s_dist_09, s_dist_10 FROM
stockWHERE s_i_id = $1 AND s_w_id = $2 FOR UPDATE <br />2007-10-11 15:49:06.027 BRT [46994] LOG:  duration: 23.220 ms 
execute<unnamed>: SELECT i_price, i_name , i_data FROM item WHERE i_id = $1 <br />2007-10-11 15:49:06.043 BRT
[46994]LOG:  duration: 14.308 ms  execute <unnamed>: SELECT s_quantity, s_data, s_dist_01, s_dist_02, s_dist_03,
s_dist_04,s_d <br />ist_05,        s_dist_06, s_dist_07, s_dist_08, s_dist_09, s_dist_10 FROM stock WHERE s_i_id = $1
ANDs_w_id = $2 FOR UPDATE <br />.<br />.<br />.<br />.<br /><br /></span>Trying to answer my initial question, I am
doingsomething like this: <br /><br />1. Through the statements TIMESTAMP, I calculate the total time interval in which
allthe statments had been executed: (END TIMESTAMP(2007-10-11 15:49: 06.043) - BEGIN TIMESTAMP (2007-10-11
15:49:05.221))<br/>2. Then I sum all the 'duration' fields of all EXECUTOR Sections of all statements executed. This,
inthesis, give me the amount of time that the executor had been used during the total time interval in which the
statementshad been executed) <br /><br />The problem I have encountered is that the sum of executor's duration time is,
*sometimes*,bigger than the total time interval in which the statements had been executed!! And this makes no sense!<br
/><blockquoteclass="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex;
padding-left:1ex;">In some tests I have done, I have found these results:<span class="q"><br />- Total Time interval
whichBenchmarkSQL submitted queries = 30 seconds <br /></span>- sum of executor's duration time during this period of
time= 2 minutes and 36 seconds!! (5x longer than total time) <br /><br /><br />How could the sum of duration time of
executorbe longer than the sum of duration of the statements that use it? <br /><br />Can anyone, please, help me to
solvethis? Many thanks, Camilo</blockquote></div><br /><hr />Veja mapas e encontre as melhores rotas para fugir do
trânsitocom o Live Search Maps! <a href="http://www.livemaps.com.br/index.aspx?tr=true" target="_new">Experimente
já!</a>

pgsql-hackers by date:

Previous
From: Greg Smith
Date:
Subject: Re: PANIC caused by open_sync on Linux
Next
From: Tom Lane
Date:
Subject: Re: URGENT HELP about 'duration' stats