[
https://issues.apache.org/jira/browse/CASSANDRA-20761?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18005151#comment-18005151
]
guo Maxwell commented on CASSANDRA-20761:
-----------------------------------------
I think it is great to add this grammar , but as we know we should make a
discussion through ML if we want to change / add a new grammar.
And I have two questions here :
1. should we also add a new grammar TRUNCATE TABLE table , and TRUNCATE TABLE
table == TRUNCATE table, table is under some keyspace;
2. we know truncate table have a rpc to all nodes to truncate table on the
node, and exception will be throw if some node do not make an ack , so what
happens if there are 10 tables under some keyspace that is to be truncated, and
some of the tables are not successfully truncated ? users may need to do
describe keyspace to know which tables are truncated successfully which are
not.
If TCM can support truncate tables atomically, that will be perfect and
question 2 is solved .
> Support TRUNCATE <keyspace> to truncate all tables in it
> --------------------------------------------------------
>
> Key: CASSANDRA-20761
> URL: https://issues.apache.org/jira/browse/CASSANDRA-20761
> Project: Apache Cassandra
> Issue Type: New Feature
> Components: CQL/Semantics
> Reporter: Stefan Miklosovic
> Priority: Normal
>
> If I want to truncate whole keyspace by one command, now I can not do that as
> I need to enumerate all tables from that keyspace and truncate one by one.
> It might be probably possible to do
> {code}
> TRUNCATE keyspace_name
> {code}
> which would internally iterate over all tables and truncate them all so user
> is saved from doing that.
> However, I think that the usage of
> {code}
> TRUNCATE keyspace_name
> {code}
> is a little bit risky because, for example, users might think that they are
> using keyspace already by USE statement so "keyspace_name" is actually a
> table name. If there is a keyspace of such name then it would truncate all
> tables in it.
> It would be probably better to have a new statement like
> {code}
> TRUNCATE KEYSPACE abc;
> {code}
> That way, it is pretty obvious what we want to truncate.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]