CQRS is a pattern that separates reads and writes into different databases or services. It helps with complex domains by allowing separate read and write models and logic. Event sourcing stores all state changes as a sequence of events, allowing the system state and data to be reconstructed from those events. CQRS and event sourcing are often used together, with commands generating events that update aggregates and get stored in the event store.