phoenix icon indicating copy to clipboard operation
phoenix copied to clipboard

PHOENIX-300 Add support for TRUNCATE TABLE

Open ragarkar opened this issue 3 years ago • 6 comments

  1. Added support for TRUNCATE TABLE statement in phoenix.
  2. Added an integration test to test the feature.

ragarkar avatar Mar 24 '22 09:03 ragarkar

Please do not use private JIRA IDs in the Apache project. Use the PHOENIX-300 ticket ID.

stoty avatar Mar 25 '22 08:03 stoty

There are a few issues to be addressed:

  • child tables (global secondary index tables and and global secondary indexes on views) also need to be handled.
  • This doesn't work for multitenant tables from tenant-specific connections (i think simply erroring out in that case is fine)
  • Some sanity checks for critical system tables would also be needed.
  • Need to think about what happens when trying to access the tables while truncating.

stoty avatar Mar 25 '22 08:03 stoty

You are preserving the splits during truncate, which is good, but you may also want to consider exposing an option that lets users remove the existing split points. (not for salted tables, of course.)

stoty avatar Mar 25 '22 08:03 stoty

Thanks for looking into these changes. How about we provide an extension to the TRUNCATE TABLE statement to preserve the splits? We can have an optional clause something like:

TRUNCATE TABLE PRESERVE SPLITS;

ragarkar avatar Mar 25 '22 09:03 ragarkar

That sounds good, @ragarkar .

stoty avatar Mar 25 '22 09:03 stoty

Or rather make preserving splits the default, and add an option to NOT preserve them.

stoty avatar Mar 25 '22 09:03 stoty