Dear MongoDB Forum Members,
I have a database with approximately 120 million records, and I would like to ask for your help in optimizing indexing and ensuring data uniqueness.
Currently, the collection has two indexes:
- ID — used as the primary identifier.
- Product ID and Data — a compound unique index that ensures uniqueness for each record.
The issue is that the ID index takes up significant storage space and is essentially redundant since uniqueness is already guaranteed by the Product ID and Data index. The collection might grow to a billion records, so I want to minimize storage costs associated with this redundant index.
My questions are as follows:
- Is it possible to completely remove the ID index? If so, how can I do this safely without risking data loss or errors when accessing the collection?
- If removing the ID index is not an option, is there a way to reduce its size? For example, by shortening the length of the ID or optimizing its storage somehow?
I would greatly appreciate any advice or recommendations on configuring the database in this situation.
Thank you for your time and assistance!