while storing data what is the difference between storing all fields in one bin as a map vs storing each field in a different bin. What are the benefits/drawbacks of each approach?
As CDTs (maps and lists) development continues, the differences are becoming less obvious.
As of 3.7.0:
- You can only create secondary indices on bins, not the value for which a map-key points to.
- For
data-in-memory
orstorage-engine memory
configurations. A bin name is stored once in a table and the individual records use a 2 byte index to reference the bin within the table which saves space for bin names longer than 2 bytes. Map keys are stored as the client provided which occupies more memory. - You are limited on the number of unique bin names and the length of a bin name. Map keys do not have these limits.
I suspect some future release will add secondary indices on map keys. But the 2nd and 3rd distinctions are unlikely to change.