QuestDB does not support changing the designated column directly. However, you can create a new table based on the old one, specifying a different designated timestamp column.
Example:
Suppose you have a table named readings with a designated column ts. This table could have been created as follows:
To change the designated column from ts to ts2, you need to:
Create a new table based on the old one.
Rename or drop the old table.
Rename the new table to the original name.
Here's how you can create the new temporary table:
CREATE TABLE readings_tmp AS (
SELECT * FROM readings)
TIMESTAMP(ts2) PARTITION BY HOUR WAL;
Note that I specified ts2 as the designated timestamp column, whereas the original table used ts. I also changed the partitioning scheme: the old table was partitioned by MONTH, while the new one is partitioned by HOUR.
Once the table is created, you can either drop or rename the old table. You might choose to simply rename it, keeping it as a backup: RENAME TABLE readings TO readings_backup;
Finally, rename the newly created table to make it available under the original name: RENAME TABLE readings_tmp TO readings;
At this point, the readings table will have a new designated timestamp column.
QuestDB does not support changing the designated column directly. However, you can create a new table based on the old one, specifying a different designated timestamp column.
Example:
Suppose you have a table named readings with a designated column
ts
. This table could have been created as follows:To change the designated column from
ts
tots2
, you need to:Here's how you can create the new temporary table:
Note that I specified
ts2
as the designated timestamp column, whereas the original table usedts
. I also changed the partitioning scheme: the old table was partitioned byMONTH
, while the new one is partitioned byHOUR
.Once the table is created, you can either drop or rename the old table. You might choose to simply rename it, keeping it as a backup:
RENAME TABLE readings TO readings_backup;
Finally, rename the newly created table to make it available under the original name:
RENAME TABLE readings_tmp TO readings;
At this point, the readings table will have a new designated timestamp column.