Commands - Change the state of the object or entity.
Queries - Return the state of the entity and will not change anything.
In traditional data management systems, there are some issues,
1. Risk of data contention
2. Managing performance and security is complex as objects are exposed to both reading and writing applications.
So in order to solve these problems, the CQRS comes to the big picture. The CQRS is responsible for either change the state of the entity or return the result.
benefits of using the CQRS are discussed below.
1. The complexity of the system is reduced as the query models and commands are separated.
2. Can provide multiple views for query purposes.
3. Can optimize the read side of the system separately from the write side.
The write side of the model handles the event's persistence and acting as a source of information to the read side. The system's read model generates materialized views of the data, which are often highly denormalized views.