Siva
Siva

Reputation: 1198

Redshift: Table is deleted from the DB with in 5 minutes automatically

I'm trying to create the table in the redshift DB using the SQL workbench using the following command.

CREATE TABLE test_table (columnone varchar, columntwo varchar, 
columnthree varchar,columnfour varchar,columnfive varchar,columnsix 
varchar,columnseven varchar,columneight varchar);

It is created successfully.

I verified the table is created from the following line. and saw the table is present and table_type is BASE TABLE

SELECT * FROM information_schema.tables WHERE table_schema = 'public'; 

I was able to insert the data into the table.

INSERT INTO test_table VALUES ('123456', '123456', 
'123456','123456', '123456','123456','123456','123456');

Row insertion is done successfully

After that I performed the query

 Select * from test_table 

and I'm able to see the results as well for this

But after 5 to 10 mins table is deleted.

I checked that table is not available in the DB by executing the following line

SELECT * FROM information_schema.tables WHERE table_schema = 'public'; 

I googled it and was not able to find any. I'm new to redshift and SQL was there any mistake I did while creating the table. The tables that are created in this DB by some other people earlier are available still. I also checked with the people who created tables earlier are not able to figure out what is the issue

Upvotes: 4

Views: 1902

Answers (1)

Siva
Siva

Reputation: 1198

As per Jon Scott comment, I tried using commit command and then I able to see the table after a long time as well. The table is not deleted now.

commit; 

This is the command I executed after the creation of the table immediately.

Also, have gone through this we have to execute this commit after performing any operation on the table else the data will not change.

Also, I have seen another option after exploring the SQL workbench connect window. There is a checkbox for Autocommit. if we select the checkbox then we need not execute the commit command everytime

Upvotes: 2

Related Questions