sql: introduce TRUNCATE TABLE operation
To implement new TRUNCATE operation, we have introduced a new P2 argument for OP_Clear opcode that calles box_truncate instead of tarantoolSqlite3ClearTable. This operation should work faster than DELETE FROM; but have a few restricts. Closes #2201. @TarantoolBot document Title: New TRUNCATE operation TRUNCATE is DDL operation. Removes all rows from a table or specified partitions of a table, without logging the individual row deletions. TRUNCATE TABLE is similar to the DELETE statement with no WHERE clause; however, TRUNCATE TABLE is faster and uses fewer system resources. It couldn't be used with system tables or with tables having FKs. It also couldn't be called in transaction. The triggers on table will have ignored. Example: TRUNCATE TABLE t1;
Showing
- extra/mkkeywordhash.c 1 addition, 0 deletionsextra/mkkeywordhash.c
- src/box/sql/delete.c 44 additions, 0 deletionssrc/box/sql/delete.c
- src/box/sql/parse.y 6 additions, 0 deletionssrc/box/sql/parse.y
- src/box/sql/sqliteInt.h 9 additions, 0 deletionssrc/box/sql/sqliteInt.h
- src/box/sql/vdbe.c 10 additions, 2 deletionssrc/box/sql/vdbe.c
- test/sql/delete.result 76 additions, 0 deletionstest/sql/delete.result
- test/sql/delete.test.lua 38 additions, 0 deletionstest/sql/delete.test.lua
Please register or sign in to comment