I have existing table which has become too large and I would like to enable partitions for the current year from timestamp field. How can I do this, I can’t find anything in the documentation, is it not possible to make a table partitioned after creation?
ALTER TABLE appointment PARTITION BY RANGE (start_on) -> does not work.
2
Answers
As per documentation:
So you might want to create a new partitioned table, and attach the old one as a (default) partition to it.
You would want something like:
It will probably be more complex, as you will also need to deal with indexes, foreign keys, etc. Of course you need to provide $1 and $2 to be at least as wide as the existing range in the table.