Reputation: 85
I'm populating a 20-column table, and I want to divide & label the records by 60 million. So the value of col20 for 1-60,000,000 records will be '1', 61,000,000-120,000,000 records will be '2', etc.
I'm taking following steps:
insert into table
select *, 1 + FLOOR( (ROW_NUMBER() OVER (order by col1) - 1)/60000000 ) as col20
from temp
I dont really familiar with Snowflake performance, I just feel that delete all & re-insert looks stupid and not efficient. Is there another way to achieve this? Or maybe its not an issue in snowflake in terms of performance?
updates: I should mean this - the table doesnt have primary key/unique key.
Thanks.
Upvotes: 0
Views: 89
Reputation: 96
You can simply do an UPDATE on col20 after the data is loaded using the same logic you described above. Is there any reason why update cannot be done?
Upvotes: 0