All quizzesHard
Schema Evolution & CQRS
Preview — 3 of 10 questions
In an event sourcing architecture, what is the core structure of the event store schema?
javascript
CREATE TABLE events (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
aggregate_id UUID NOT NULL,
event_type TEXT NOT NULL,
version INT NOT NULL,
payload JSONB NOT NULL,
occurred_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
UNIQUE (aggregate_id, version)
);AA single append-only events table storing every state change as an immutable record with aggregate ID, event type, version, and payload
BA normalized table per aggregate type storing only the current computed state
CA star schema with separate fact and dimension tables per aggregate type
DA time-series table partitioned by minute for efficient range queries
In CQRS, what is a read model projection and why does it exist?
AA projection is a foreign key that joins the command model to the query model in the same database
BA projection is a denormalized, query-optimized view built by consuming events and maintaining a separate read store tailored to specific query patterns
CA projection is a database index that automatically mirrors the write model's structure
DA projection is a stored procedure that transforms write queries into read queries at runtime
Which criterion is most critical when selecting a sharding key for a multi-tenant SaaS application?
AThe sharding key should be the column with the highest cardinality in the entire schema
BThe sharding key must always be a UUID to ensure global uniqueness
CThe sharding key should distribute writes evenly across shards and co-locate related data that is frequently queried together on the same shard
DThe sharding key must be a monotonically increasing integer to maintain sort order across shards
Sign up free to play
Answer all 10 questions (7 more), see explanations for every answer, and track your score.