Turn on statement level timing in YCQL

You are probably familiar with the \timing meta-command in YSQL which turns on and off displaying of how long each SQL statement takes. 

But did you know that there is also a similar feature available in YCQL?

It’s the TIMING command!

It was first available in YugabyteDB 2.18 for SELECT statements, but as of YugabyteDB 2.19.2, it also works for DML operations!

Example:

				
					cassandra@ycqlsh> TIMING;
Timing is currently disabled. Use TIMING ON to enable.

cassandra@ycqlsh> TIMING ON;
Now Timing is enabled

cassandra@ycqlsh> CREATE KEYSPACE k;
84.95 milliseconds elapsed

cassandra@ycqlsh> CREATE TABLE k.t(c1 INT PRIMARY KEY, c2 VARCHAR) WITH transactions = {'enabled':true};
743.56 milliseconds elapsed

cassandra@ycqlsh> CREATE INDEX t_c2_idx ON k.t(c2);
861.01 milliseconds elapsed

cassandra@ycqlsh> INSERT INTO k.t (c1, c2) VALUES (1, 'YugabyteDB is awesome!');
131.63 milliseconds elapsed

cassandra@ycqlsh> UPDATE k.t SET c2 = 'YugabyteDB is AWESOME!' WHERE c1 = 1; -- :)
80.29 milliseconds elapsed

cassandra@ycqlsh> SELECT * FROM k.t;

 c1 | c2
----+------------------------
  1 | YugabyteDB is AWESOME!

62.18 milliseconds elapsed
(1 rows)

cassandra@ycqlsh> TIMING OFF;
Disabled Timing.
				
			

Have Fun!

I go to the fair just to see the pigs!