Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Truncate Table #31

Open
kokoro011 opened this issue Nov 29, 2018 · 3 comments
Open

Truncate Table #31

kokoro011 opened this issue Nov 29, 2018 · 3 comments

Comments

@kokoro011
Copy link

Instead of dropping table and creating a new one, is there a way to truncate/delete all records in an existing table to then loading up the new data?

@agawronski
Copy link
Owner

I'm sure this is possible. Whether there is a benefit is debatable. From what I understand it is better to drop and create: "COPY loads large amounts of data much more efficiently than using INSERT statements, and stores the data more effectively as well." (https://docs.aws.amazon.com/redshift/latest/dg/c_best-practices-use-copy.html).

Is there a specific reason that it is better? @yaojiach do you have any thoughts on this?

@agawronski
Copy link
Owner

@kokoro011 was this request due to performance or another reason? Will be closing this issue if there is no benefit to truncation.

@yaojiach
Copy link
Collaborator

yaojiach commented Feb 5, 2020

It could be helpful when you don't want to append to an existing table and don't want to re-specify the column types either.

Maybe we can run a truncate and then use append = true in this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants