What Should Do With Uncleaned Secondary Indexes?

Hi,

I’m using Couchbase Server Enterprise Edition 7.6.2 and i have a problem with secondary indexes.
As i read couchbase makes auto clean on indexes and i only have maximum 500Mb data on all buckets.

Somehow my secondary index folder is 3.7Gb.

root@mycbserver:/opt/couchbase/var/lib/couchbase/data# du -cha --max-depth=1	3.7G	./@2i

And i need to clean it because it takes so much disk space, what should i do?

Thank you.

Indexes take disk space.
Either get more disk space or use less indexes. Disk space is cheap.

Hi thank you for your response,

I need to decrease disk usage, i have approximately 10 secondary index, and each one more than 200 Mb.

Should couchbase make compose to secondary indexes as automatically?

Why they are so big?, i don’t have such a big data in buckets

the size of the index depends on the index and the number of documents that are indexed.

I want to clear unnecessary data on secondary indexes, is it possible?

Because i don’t have such a big data on my buckets but secondary indexes are very big

AFAIK, indexes do not contain unnecessary data (such as indexes for documents that have been deleted). There is no “compact” or anything else like that for indexes. If you want to test that theory, you could record the size of an index, then deleted it and recreate it and check the new size to see if it is smaller.

Hi again,
I have recreated one of the my secondary index, before the recreation index was using 105 Mb then it decreased to 1.5Mb.

Before Recreation

105M	./DailyReport_idx_reportId_status_desc_6874942799164397019_0.index

After dropping and creating same index

1.2M	./DailyReport_idx_reportId_status_desc_18421763975549269942_0.index

So i have few question:

  1. Does secondary indexes keeps uncleaned data?
  2. If first question is yes, why it only make clean uncessary data on recreate, why it does not automatic clean?
  3. Does secondary index recreation makes any damage to system?

As i read couchbase documentation they said:
”Flush buckets that have indexes: flushing a bucket deletes all data in a bucket; and even if there are pending updates not yet processed, flushing causes all indexes to drop their own data.”

But our developers cleans data on buckets with “Delete From BucketName”, may be this reason index data does not clean?

Hi,

I was right, this problem solved by using flush button on the bucket, our developers was using delete from bucketName, this reason bucket indexes wasn’t clear old data and they keep growing.