[ 
https://issues.apache.org/jira/browse/CASSANDRA-18861?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17767889#comment-17767889
 ] 

Stefan Miklosovic edited comment on CASSANDRA-18861 at 9/22/23 8:22 AM:
------------------------------------------------------------------------

examples of the output:

{code}
cassandra@cqlsh> list USERS ;

 name      | super | datacenters
-----------+-------+-------------
 cassandra |  True |         ALL

(1 rows, 12ms elapsed)
{code}

{code}
cassandra@cqlsh> update myks.mytb SET name = 'stefan' WHERE id = 1;
cassandra@cqlsh> update myks.mytb SET name = 'stefan' WHERE id = 1 IF exists;

 [applied]
-----------
      True

(36ms elapsed)
{code}

{code}
cassandra@cqlsh> BEGIN BATCH insert into myks.mytb (id, name) VALUES (1, 
'joe'); APPLY BATCH;
cassandra@cqlsh> BEGIN BATCH insert into myks.mytb (id, name) VALUES (1, 'joe') 
IF NOT EXISTS ; APPLY BATCH;

 [applied] | id | name
-----------+----+------
     False |  1 |  joe

(8ms elapsed)
{code}

It is interesting to see that elapsed time is written only for CAS statements. 
So if I do this when one statement is CAS and another is not:

{code}
cassandra@cqlsh> BEGIN BATCH insert into myks.mytb (id, name) VALUES (1, 'joe') 
IF NOT EXISTS; insert into myks.mytb (id, name) VALUES (1, 'joe'); APPLY BATCH;

 [applied] | id | name
-----------+----+------
     False |  1 |  joe

(9ms elapsed)
{code}

It will basically take into account not the time of whole batch but only of 
statements which are CAS. So it will leave out another one from the elapsed 
time computation.

That is because of this (1). Basically, we will ever have that elapsed timeout 
displayed only in case a statement returns some rows back to client and we 
completely leave out all other statements which is quite unfortunate. 

Maybe it would be better to hide this behind a flag in cqlshrc and once turned 
on (default turned off), it would write the elapsed time to absolutely 
everything? 

(1) 
https://github.com/apache/cassandra/blob/a4e5e0bd2e5bf80275443bcefc72cebad5ea10fc/pylib/cqlshlib/cqlshmain.py#L996-L1006


was (Author: smiklosovic):
examples of the output:

{code}
cassandra@cqlsh> list USERS ;

 name      | super | datacenters
-----------+-------+-------------
 cassandra |  True |         ALL

(1 rows, 12ms elapsed)
{code}

{code}
cassandra@cqlsh> update myks.mytb SET name = 'stefan' WHERE id = 1;
cassandra@cqlsh> update myks.mytb SET name = 'stefan' WHERE id = 1 IF exists;

 [applied]
-----------
      True

(36ms elapsed)
{code}

{code}
cassandra@cqlsh> BEGIN BATCH insert into myks.mytb (id, name) VALUES (1, 
'joe'); APPLY BATCH;
cassandra@cqlsh> BEGIN BATCH insert into myks.mytb (id, name) VALUES (1, 'joe') 
IF NOT EXISTS ; APPLY BATCH;

 [applied] | id | name
-----------+----+------
     False |  1 |  joe

(8ms elapsed)
{code}

It is interesting to see that elapsed time is written only for CAS statements. 
So if I do this when one statement is CAS and another is not:

{code}
cassandra@cqlsh> BEGIN BATCH insert into myks.mytb (id, name) VALUES (1, 'joe') 
IF NOT EXISTS; insert into myks.mytb (id, name) VALUES (1, 'joe'); APPLY BATCH;

 [applied] | id | name
-----------+----+------
     False |  1 |  joe

(9ms elapsed)
{code}

It will basically take into account not the time of whole batch but only of 
statements which are CAS. So it will leave out another one from the elapsed 
time computation.

> add time elapsed for simple CQL statement in the cql shell
> ----------------------------------------------------------
>
>                 Key: CASSANDRA-18861
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-18861
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: CQL/Semantics
>            Reporter: Ling Mao
>            Assignee: Ling Mao
>            Priority: Normal
>             Fix For: 5.x
>
>




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to