How to do times and device in mysql? -


i want take 2 values in ms devide them , *1000.

select   count_star exec_count,  sum_timer_wait total_latency,  (sum_timer_wait/count_star)*1000 'avg_latency(sec)'  dbname 

the following working

(sum_timer_wait/count_star) 'avg_latency(ms)'      exec_count      total_latency    avg_latency(ms)     13              3282064379000    252466490692.3077     13              23618632000      1816817846.1538     1               10046560000      10046560000.0000 

however when add *1000 convert seconds bad value

(sum_timer_wait/count_star)*1000 'avg_latency(sec)'  exec_count     total_latency    avg_latency(sec) 13             3282064379000    25246649069230.7692 13             23618632000      181681784615.3846 1              10046560000      1004656000000.0000 

it not giving bad value rather extending values more decimal points.

you can use floor nearest inetger value. try this:

select   count_star exec_count,  sum_timer_wait total_latency,  floor((sum_timer_wait/count_star)*1000) 'avg_latency(sec)' dbname 

the floor returns largest integer value not greater 'avg_latency'.


Comments

Popular posts from this blog

c# - SharpSsh Command Execution -

python - Specify path of savefig with pylab or matplotlib -

How to run C# code using mono without Xamarin in Android? -