[
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:31 AM:
------------------------------------------------------------------------
examples of the output:
{code}
cassandra@cqlsh> ALTER TABLE myks.mytb ADD age int;
{code}
{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.
Or am I getting it wrong?
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? I mean ... we either print it _everywhere_ if a user asked for it
or nowhere. I dont see a reason why it should be displayed only for statements
returning a row.
For example, if I do "DROP KEYSPACE mykeyspace", it will take way more than a
couple of milliseconds. That is because dropping of a keyspace seems to be
synchronous operation from CQLSH perspective. Even I do not know how long that
statement took exactly, one can just feel from the CQLSH as he is executing
that statement that it takes way longer than "3ms".
(1)
https://github.com/apache/cassandra/blob/a4e5e0bd2e5bf80275443bcefc72cebad5ea10fc/pylib/cqlshlib/cqlshmain.py#L996-L1006
was (Author: smiklosovic):
examples of the output:
{code}
cassandra@cqlsh> ALTER TABLE myks.mytb ADD age int;
{code}
{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.
Or am I getting it wrong?
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? I mean ... we either print it _everywhere_ if a user asked for it
or nowhere. I dont see a reason why it should be displayed only for statements
returning a row.
(1)
https://github.com/apache/cassandra/blob/a4e5e0bd2e5bf80275443bcefc72cebad5ea10fc/pylib/cqlshlib/cqlshmain.py#L996-L1006
> 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: [email protected]
For additional commands, e-mail: [email protected]