In order to run the
ANALYZE operation you’ll need to ensure that whatever user is specified in your RDB configuration file also owns these tables - otherwise you’ll get an error and it’ll skip the table.
Once upon a time this used to be quite an annoying issue - VACUUM and ANALYZE operations were essentially required to free up space, sort tables and to update table statistics. Over time AWS realised that nobody really wanted to perform these database operations, they had to and instead started to run these on a more regular, automated basis - largely removing the need to update statistics and vacuum tables manually.
However - there are a few instances where you may want to still perform these operations manually where you’ve performed a large operation that may have changed the stats significantly - or you have a table that requires resorting reindexing.
For ANALYZE you can run this operation manually.
VACUUM DELETE operations will largely run in the background, as will VACUUM SORT up to an extent. If you have tables that are unsorted above a threshold (50% is not a bad rule of thumb) then you have two options:
- Perform a deep copy - essentially copying and sorting the table in the process. You’ll want a sizeable amount of disk space here if doing so as your table will first be decompressed before being sorted and recompressed.
- Accept that this table will always remain unsorted, and become increasingly so. Consider sorting the table as a sleight against thermodynamics. Instead acknowledge, accept and warm to the idea that all available entropy has been exhausted and patiently await the heat death of the universe.
Hope that helps!