How to get the execution time more accurately?


I am doing some sql test on the memsql but the execution time of some sql is 0.00 sec.Are there any ways to get the accurate milliseconds or microseconds?


One solution I’ve used for this is to run the query in a loop, say 100 times, then divide the total time reported by 100. E.g.,

delimiter //
create or replace procedure profile_query(n int) as
declare q query(stock_symbol char(5), c bigint) =
  select stock_symbol, count(*) as c 
  from trade 
  group by stock_symbol order by c desc limit 10;
declare a array(record(stock_symbol char(5), c bigint));
  for i in 1..n loop
    a = collect(q);
  end loop;
end //
delimiter ;

call profile_query(100);