hey all
1. how can i update / patch a nested entity fields (nested maps / vectors)? for example, adding / removing an element to the vector, changing the value of a nested field in a map
2. what are the best practices / considerations when choosing when to nest and when to normalize? (i know it's kinda generic question, i'm more interested in xtdb point of view on this)
(i've tried something like set col.nested = val but it didn't work https://play.xtdb.com/?version=2.0.0-beta6&type=sql-v2&enc=2&txs=NobwRAzgnhAuCmBbAtLAlo%2BYBcA7ArgDaEA0YsAHhDmGrhPAE6wAEdsA9iwA7wfeF4LRvADGHRgBMILEAH00k7CwCMJFogCG3ZSE3KVAX0MBuMIZLhK1bGHzdJmhDz4ChDVlu4A6AEYsAXhYAZhYAdwALJiEFSUDVMzJoOCRUDCw8IkILKyoaADEAJQB5AFkXfkEwJJgEFHRMHAJiQwBdIA)
thanks 🙂
Hey @itai you can't do nested patching yet, unfortunately, so you'll have to do that work in the app code. We may in the future implement a JSON Merge Patch-style API, per the comments in https://github.com/xtdb/xtdb/pull/3944 > when to nest and when to normalize? The timeless wisdom I often refer to is: normalize until it hurts, denormalize until it works (i.e. runs fast enough). In general I don't think XTDB should be treated too differently to Postgres (etc.), but not having to worry about the number of columns in a table is often quite nice (because XT is columnar, and not row-oriented) It is perhaps worth noting that 6NF (one 'attribute' per table) can make the history more meaningful and simpler to analyse because the changes are more discrete. Another rule of thumb: things that change together should travel together (e.g. live in the same table, or perhaps nested under the same column!)