Another question regarding partitions: let’s say I want to change a partition strategy of a table. I know we can’t directly do that, but theres any way of
• create a new table with proper partition strategy;
• copy old table to this new table;
• delete old table;
• rename new table to old name.
a
Alex Pelagenko
05/03/2023, 3:06 PM
yes, these steps is the way to go, all are pretty standard SQL
j
javier ramirez
05/03/2023, 3:06 PM
yes. Exactly as you said. CREATE TABLE statement, plus INSERT/SELECT into new one, plus DROP table, and then RENAME TABLE
g
Gabriel Mocan
05/03/2023, 3:41 PM
Thanks guys, I’m fairly new to SQL so still learning.
a
Alex Pelagenko
05/03/2023, 4:02 PM
We may be able to change partitions without rewriting table with relatively low effort, so if you have a case for it, feel free to leave feedback as Github issue / discussion
g
Gabriel Mocan
05/03/2023, 4:36 PM
@Alex Pelagenko I think it’s a useful feature. In my case I create tables dynamically via ILP with WEEK as default, but some specific tables are better suited to MONTH, others more granular to DAYS.
So I’m designing a housekeeping loop in my code to manage retention policy and also set partitions accordingly to table specific keywords.