[ https://issues.apache.org/jira/browse/IGNITE-5819?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16453731#comment-16453731 ]
Vladimir Ozerov edited comment on IGNITE-5819 at 4/26/18 9:13 AM: ------------------------------------------------------------------ Hi [~roman_s], In this patch truncate is implemented using {{clear}} operation. This operation is very slow as it iterates over all keys and delete them one-by-one. Also, this operation is not atomic, meaning that in case node is killed in the middle, cache will be in undefined state - some keys are removed, some aren't. Correct implementation of this operation should follow these rules: 1) Be fast - no key-by-key iterations with O(N) complexity 2) Respect transaction boundaries for MVCC case 3) Handle node failures properly - it either completes and everything is removed, or it fails and nothing is removed. 4) Properly handle shared cache group case. That said I do not think we should implement this command for now for two reasons: 1) We are likely to deprecate cache groups 2) MVCC is under active development and {{TRUNCATE}} would behave much differently in MVCC case. 3) We would likely need exclusive table lock feature to ensure that concurrent queries and transactions are not disrupted by concurrent execution of this command. It is better to return to this command in about half a year when questions around MVCC, table locks and cache groups are resolved. was (Author: vozerov): Hi Roman, In this patch truncate is implemented using {{clear}} operation. This operation is very slow as it iterates over all keys and delete them one-by-one. Also, this operation is not atomic, meaning that in case node is killed in the middle, cache will be in undefined state - some keys are removed, some aren't. Correct implementation of this operation should follow these rules: 1) Be fast - no key-by-key iterations with O(N) complexity 2) Respect transaction boundaries for MVCC case 3) Handle node failures properly - it either completes and everything is removed, or it fails and nothing is removed. 4) Properly handle shared cache group case. That said I do not think we should implement this command for now for two reasons: 1) We are likely to deprecate cache groups 2) MVCC is under active development and {{TRUNCATE}} would behave much differently in MVCC case. 3) We would likely need exclusive table lock feature to ensure that concurrent queries and transactions are not disrupted by concurrent execution of this command. It is better to return to this command in about half a year when questions around MVCC, table locks and cache groups are resolved. > SQL: add support for TRUNCATE TABLE command. > -------------------------------------------- > > Key: IGNITE-5819 > URL: https://issues.apache.org/jira/browse/IGNITE-5819 > Project: Ignite > Issue Type: Task > Components: sql > Reporter: Andrew Mashenkov > Assignee: Roman Shtykh > Priority: Major > Labels: sql-engine > Fix For: 2.6 > > > Add support for "TRUNCATE TABLE" command syntax. -- This message was sent by Atlassian JIRA (v7.6.3#76005)