SQL plus NoSQL database
I'm quite comfortable with the CRUD(Create Read Update Delete) operations on a relational database system. However while dealing with event streams like audit logs where preserving history is important. The read and write operations on a particular object may not result in the same value thats when CQRS with event streams could be useful. However it comes with its own complexities and understanding if and where its worth implementing is very important.
CQRS(Command Query Responsibility Segregation) works with queries and commands. There's a separate database for read and write operations. So, queries are used to read the object while keeping the state of the object same. Whereas, commands are used for write operations that only change the state of the object and not show the result. Kafka Streams help implementing CQRS with event streams.
Therefore in order to avoid conflicts while updating data, CQRS with event streams could be useful.
Among the 2 database for CQRS; for command based write operation SQL could be used and for query based read operations NoSQL. NoSQL because quering would be quicker and since read queries are more and also could be more complicated because it may be retrieving/aggregating data from multiple sources so NoSQL could simpify the process more than SQL.
Senior Advanced Software Engineer at Honeywell
3 年Thanks Ayush Pandey, was trying to solve something similar and now I have the answer.
Thanks for sharing Ayush Pandey
Account Manager | ForMining Space
3 年What a great post Ayush!
Account Manager | ForMining Space
3 年Really love reading your post Ayush!