Most efficient method for persisting complex types with variable schemas in SQL

前端 未结 5 1018
旧巷少年郎
旧巷少年郎 2021-01-03 08:21

What I\'m doing

I am creating an SQL table that will provide the back-end storage mechanism for complex-typed objects. I am trying to determine how

5条回答
  •  臣服心动
    2021-01-03 08:40

    How about looking for a solution at the architectural level? I was also breaking my head on complex graphs and performance until I discovered CQRS.

    [start evangelist mode]

    • You can go document-based or relational as storage. Even both! (Event Sourcing)
    • Nice separation of concerns: Read Model vs Write Model
    • Have your cake and eat it too!

    Ok, there is an initial learning / technical curve to get over ;)

    [end evangelist mode]

    As you stated: "I need to be able to create variable schemas on the fly without changing anything about the database access layer." The key benefit is that your read model can be very fast since it's made for reading. If you add Event Sourcing to the mix, you can drop and rebuild your Read Model to whatever schema you want... even "online".

    There are some nice opensource frameworks out there like nServiceBus which saves lots of time and technical challenges. All depends on how far you want to take these concepts what you're willing/can spend time on. You can even start with just basics if you follow Greg Young's approach. See the info in the links below.

    See

    • CQRS Examples and Screencasts
    • CQRS Questions
    • Intro (Also see the video)

提交回复
热议问题