All Products
Document Center

Query SQL traffic distribution and QPS

Last Updated: Jun 18, 2021

You can run the following statement to query SQL traffic distribution and QPS:

obclient>SELECT/*+ PARALLEL(15)*/, t1.svr_ip,  COUNT(*) AS RPC_COUNT,
      AVG(t1.elapsed_time), AVG(t1.queue_time)  
      FROM oceanbase.gv$sql_audit t1, __all_server t2  
      WHERE t1.svr_ip = t2.svr_ip 
      AND tenant_id = 1001
      AND SQL_ID = 'BF7AA13A28DF50BA5C33FF19F1DBD8A9'
      AND IS_EXECUTOR_RPC = 0    
      AND request_time > (time_to_usec(now()) - 1000000)    
      AND request_time < time_to_usec(now())
      GROUP BY t1.svr_ip;