I have an table with millions of rows.
I have column called time_from_device
(which is of type timezone with time stamp
)
id | name | t1 | t2 | t3 | time_from_device |
---------------------------------------------
Now i want to add a column called created_at
whose value will be now()
But before i set the default value of created_at
as now(), I want to fill the existing rows created_at
with time_from_device - INTERVAL '1 hour'
So I am doing the following
ALTER TABLE devicedata ADD COLUMN "created_at" timestamp with time zone;
This creates a new column created_at
with NULL
values
Now i want to fill the column with time values from time_from_device - INTERVAL '1 hour'
UPDATE devicedata SET created_at = time_from_device - INTERVAL '1 hour';
Since there are millions of rows, this command just hangs
How can I know whether its working or not