user3333553
user3333553

Reputation: 383

Disk space reclaim by Redshift after drop table

After dropping a table ,does redshift reclaim the free disk space ,or do we need to run vaccum.

Upvotes: 4

Views: 6427

Answers (1)

Sandesh Deshmane
Sandesh Deshmane

Reputation: 2305

drop table release the space.

if you are doing delete operation for rows of table then you should fire vaccumm delete only command.

No need to fire vaccum in case of drop table in redshift

Fire below command to check DB size before and after table drop to see if gains space

select sum(mbytes)/1024 as db_size_in_gb, database from (
select trim(pgdb.datname) as Database,
trim(a.name) as Table, b.mbytes
from stv_tbl_perm a
join pg_database as pgdb on pgdb.oid = a.db_id
join (select tbl, count(*) as mbytes
from stv_blocklist group by tbl) b on a.id=b.tbl
where a.slice=0
order by db_id, name)
group by database;

Upvotes: 6

Related Questions