Following the line of this question:
In case a table is too big in the Cassandra database, can I execute the compaction only on that table? If so:
- Will the system use the same amount of resources for one table? (Compaction will take all available RAM even for a short period of time.)
- Will it be efficient to do this? (If in the end, we have to do a big DB compaction once a week, this doesn't seem to be a good use of resources.)
Any other advantages/disadvantages that you can point out?
Is it possible? yes. Will it be more efficient? Probably not.
Cassandra will still take all the resources it needs to process the SSTables for a certain table, for a smaller table it might be possible that the system will use less resources but the larger tables will definitely use the same amount as with the full keyspace-compaction. So instead of having 1 big time window of high-resource usage, you will have a lot of short but equally resource intensive moments.
Efficiency wise, it will be a tad less efficient. During a full compaction cassandra can process multiple tables at the same time (if resources permit it), single table compaction will do one at a time, so the total time spent is expected to be bigger.
A big disadvantage here will be the administrative overhead. Dataminer can create/remove database tables on the fly (loggertables), which you will need to add/remove manually to the schedule. If there is a new table added in a software update, you will need to schedule this as well. Making the whole process error prone.
In the end, by doing compaction per table you would end up with more resource intensive moments, more time spent per complete compaction cycle and a more error prone process due to the administrative overhead.
In addition to Brent’s answer, for a couple of customers, we had to execute compactions per table because there was insufficient disk space.
SizeTieredCompactionStrategy is used, which requires you to have at least 50% of the Cassandra data to be available as free disk space.
The ‘Cassandra data’ being the entire keyspace size in case of a regular “full” compaction or being a single table in case of compacting a single table.