Database Design for Banking in 2026: Core Schemas and Sharding
Banking database design is the modelling of a bank's system of record around an append-only, double-entry ledger: every money movement is stored as balanced postings in exact decimal amounts, written in one ACID transaction with an idempotency key, while balances, reports and AML checks read from derived views.
Core banking database design principles
A banking database is designed around the ledger, not around the customer screen. Every card payment, SEPA credit transfer and overnight interest accrual ends as rows in a posting table, and every balance the customer sees is computed from those rows. If the ledger model is wrong, the result is not a slow page but reconciliation breaks, audit findings and money nobody can locate.
The principles below have held from mainframe files through relational databases to distributed cloud systems. They sit underneath every layer of a digital banking architecture, whatever engine you pick.
Immutability
Posted entries are never updated or deleted. A mistake is fixed with a new reversing entry, so the ledger only grows forward.
Double-entry bookkeeping
Every movement debits one account and credits another for the same amount. Per transaction and per currency, the postings sum to zero.
Derived balances
The postings are the source of truth. Stored balances are a cache that must always equal the sum of postings, and a job checks that it does.
In practice this means NUMERIC/DECIMAL or integer minor units for every amount (never FLOAT, which cannot represent 0.10 exactly), constraints enforced in the database and not only in application code, and a posting table that is append-only from the first migration. These choices are cheap at design time and very expensive to change once production money sits in the tables.
Let's discuss your project and see how we can launch your digital banking product together
Request demoThe banking ER model: entities and relationships
A banking data model needs five core entities: customer, product, account, transaction and posting. Tutorial ER diagrams of a "bank management system" add branch, employee and loan tables, which is fine for a classroom, but a production fintech schema is organised around money movement. The relationships look like this:
- Customer 1:N Account - one person or company holds many accounts, in several currencies. Joint accounts need an account_holder link table (N:M).
- Product 1:N Account - each account is an instance of a product (current account, savings, wallet, loan) whose rules live as data.
- Transaction 1:N Posting - one business event (a transfer, a card purchase, a fee) produces two or more postings that balance.
- Account 1:N Posting - an account's history is simply its postings ordered by booking time.
- Account 1:N Hold - reservations of funds (card authorisations, pending payouts) are separate rows, not postings.
| Entity | Key columns | Design notes |
|---|---|---|
| Customer | customer_id, type (person/business), status, risk_level, created_at | PII encrypted at column or application level. KYC checks and their results sit in their own append-only table, linked by customer_id. |
| Product | product_id, type, currency_rules, fee_config, interest_config, limits | A savings account and a wallet differ by configuration, not by code, so a new product needs no schema change. |
| Account | account_id, customer_id, product_id, currency, IBAN, status, ledger_balance, available_balance, version | Balances are cached aggregates updated in the same transaction as the postings. version supports optimistic locking. |
| Transaction | transaction_id, idempotency_key, type, channel, external_ref, status, created_at | Stores external references such as the SWIFT UETR or SEPA end-to-end ID. The idempotency key is unique. |
| Posting | posting_id, transaction_id, account_id, amount, currency, direction (DR/CR), booking_date, value_date | Append-only. Booking date is when it was recorded, value date is when interest starts or stops counting. |
On normalisation: keep reference data and the ledger in third normal form (3NF), because duplicated customer or product data drifts. Denormalise only in read models, such as a statement table or a search index, that are rebuilt from the ledger and can be thrown away. Many cores also keep a general ledger (chart of accounts: customer funds, fee income, safeguarding, suspense) separate from customer accounts, so finance reports and the trial balance come straight from the same postings.
A minimal ledger schema in SQL
The core of the ledger fits in three tables, and most of the safety comes from constraints rather than application code. The example below is PostgreSQL; the same ideas carry over to Oracle, SQL Server or a distributed SQL engine.
CREATE TABLE transactions (
transaction_id uuid PRIMARY KEY,
idempotency_key text NOT NULL UNIQUE,
type text NOT NULL,
status text NOT NULL CHECK (status IN ('pending','posted','reversed')),
created_at timestamptz NOT NULL DEFAULT now()
);
CREATE TABLE postings (
posting_id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
transaction_id uuid NOT NULL REFERENCES transactions,
account_id uuid NOT NULL REFERENCES accounts,
amount numeric(20,4) NOT NULL CHECK (amount > 0),
currency char(3) NOT NULL,
direction char(2) NOT NULL CHECK (direction IN ('DR','CR')),
booking_date date NOT NULL,
value_date date NOT NULL
);
REVOKE UPDATE, DELETE ON postings FROM app_role;
Three details matter more than they look. The unique idempotency_key means a client that retries after a timeout gets the original result instead of a second payment. Positive amounts with an explicit direction are easier to audit than signed numbers. And revoking UPDATE and DELETE from the application role turns "append-only" from a convention into a rule the database enforces. The balancing check (debits equal credits per transaction and currency) runs inside the posting function before commit, and again in the nightly reconciliation.
Balance types: ledger, available, held and pending
One account needs several balances, and mixing them up is the most common cause of overdrafts nobody approved. A card authorisation, for example, reserves money days before the clearing file turns it into a posting.
| Balance | Definition | Where it comes from |
|---|---|---|
| Ledger (booked) | Sum of all posted entries | Postings table; the figure in statements and accounting |
| Held (reserved) | Funds blocked but not yet moved | Holds table: card authorisations, outgoing payments awaiting a scheme, compliance blocks |
| Available | Ledger minus holds, plus any overdraft limit | Computed; this is what spending checks use |
| Pending incoming | Credits announced but not settled | Shown to the customer, never spendable |
The card lifecycle shows why holds deserve their own table. Authorisation creates a hold and lowers the available balance. Clearing, often one to three days later and sometimes for a different amount (tips, hotel pre-authorisations, FX), creates the postings and releases the hold. A hold that never clears expires after a set period. Multi-currency payments follow the same pattern with an extra FX leg: the customer account is debited in EUR, a currency position account is credited, and a second pair books the GBP side. If an FX provider such as Currencycloud executes the conversion, its trade reference belongs on the transaction row so the provider's statement can be matched line by line.
Consistency, ACID and idempotency
Banking needs the full ACID guarantee because a debit that commits without its credit is missing money, not a degraded service.
| Property | What it means for banking | Practical enforcement |
|---|---|---|
| Atomicity | All postings of a transfer commit together or not at all. | One database transaction per business transaction; a saga with compensating entries when the legs live in different systems. |
| Consistency | Debits equal credits per transaction and currency; constraints always hold. | CHECK and foreign-key constraints plus a balancing assertion before commit. |
| Isolation | Two concurrent payments cannot both spend the same available balance. | SELECT ... FOR UPDATE on the account row, or optimistic locking on a version column; SERIALIZABLE where the logic is complex. |
| Durability | A confirmed payment survives a crash. | Write-ahead log, synchronous replication to a standby in another zone. |
Idempotency is the part most tutorials skip. Networks time out, mobile apps resend, and card schemes deliver the same message twice. Every write API should accept an idempotency key, store it in the same transaction as the postings, and return the stored result on a repeat. The same applies to webhooks from providers: record the provider's event ID with a unique constraint and ignore duplicates.
Event sourcing goes one step further and treats the ordered event log as the only record, with balances rebuilt by replaying it. It gives a natural audit trail and point-in-time queries ("what was the balance at 09:15 on 3 March?"), but every balance read then needs a snapshot or a CQRS read model. Many teams take the middle road: an append-only posting table as the event log, plus a cached balance updated in the same transaction.
What database systems do banks use?
Banks run a mix: legacy cores still sit on IBM Db2 or IMS on mainframes, many vendor cores use Oracle, and newer fintech platforms mostly choose PostgreSQL or a distributed SQL database. The choice follows the transaction model, not fashion.
| Option | Typical use | Trade-off |
|---|---|---|
| Mainframe (Db2, IMS) | Incumbent banks' cores, batch-heavy processing | Proven throughput, scarce skills and high cost of change |
| Oracle, SQL Server | Vendor core banking packages, large banks | Mature tooling, licence cost |
| PostgreSQL (incl. Aurora, AlloyDB, Azure) | Most fintech ledgers, EMIs, payment institutions | Strong ACID and NUMERIC; scaling past one primary needs sharding or partitioning |
| Distributed SQL (CockroachDB, YugabyteDB, Spanner) | Multi-region ledgers, very high write volumes | Serializable transactions across nodes, higher latency per write and more operational care |
| Purpose-built ledgers (e.g. TigerBeetle) | High-throughput double-entry accounting as a component | Very fast for postings, but customer, product and compliance data live elsewhere |
Document and key-value stores are useful around the ledger (sessions, notifications, search, KYC documents) but rarely as the ledger itself, because multi-row atomic writes and constraints are what make money safe. Teams moving off a mainframe usually change the database and the core banking modernization plan together, migrating the ledger last.
Sharding strategies for high-volume transaction processing
Sharding splits the ledger across independent database nodes once one primary can no longer absorb peak writes. The scale of real payment systems shows why it gets planned early: India's UPI processed over 20 billion transactions a month from August 2025 and set a single-day record of 754 million on 18 October 2025, about 8,700 per second averaged over the day (our calculation; peaks run far higher).
Choosing a shard strategy
Hash sharding by account or customer ID suits most banking ledgers, because it keeps each account's postings on one node and spreads writes evenly. A shard map (routing table) tells the application which node holds which key.
| Strategy | How it works | Banking fit | Watch out for |
|---|---|---|---|
| Hash-based | A hash of the shard key (account_id) picks the node. Consistent hashing limits data movement when nodes are added. | Even write distribution across accounts. | Queries across many accounts fan out to every shard. |
| Range-based | Ranges of the key or of time go to fixed nodes. | Time-based partitions for history and archiving. | New accounts and recent postings pile onto the newest shard. |
| Geo-sharding | Data placed by customer jurisdiction (EU, UK, Canada). | Data residency and lower latency. | Cross-border transfers become cross-shard transactions. |
| Tenant / directory-based | A lookup table assigns each tenant or large client to a shard. | Platforms serving several brands, or a very large business client. | The directory must be replicated and highly available. |
Before sharding, exhaust the cheaper steps: table partitioning by booking date, read replicas, moving reporting to a warehouse, and removing hot rows. Shard keys must have high cardinality (never currency, country or status), and the shard count should be generous from the start, because resharding a live ledger is one of the hardest operations in fintech. Platforms that host several brands on one ledger face the same choice per tenant, covered in banking multi-tenancy.
Hot accounts, cross-shard transfers and read scaling
The bottleneck in a banking ledger is usually not total volume but a few hot accounts that every transaction touches. A fee income account, a settlement account at a scheme or a safeguarding account can receive one posting per customer payment, and row locking on its balance then serialises the whole system.
- Do not lock internal balances per write. Append postings to internal accounts without updating a cached balance, and compute it on read or in periodic snapshots.
- Split hot accounts into sub-accounts (fee income 1..N) chosen at random, and sum them for reporting.
- Batch sweeps: accumulate small fee postings and move them to the GL account in one entry per minute or per hour.
- Cross-shard transfers use a saga: debit on shard A into a transit account, credit on shard B, with a compensating entry if step two fails. Every step carries the same idempotency key, and two-phase commit is rarely worth its latency.
Reads scale separately from writes. Balance lookups and statements can come from replicas; analytics, AML monitoring and regulatory reports go to a warehouse (BigQuery, Redshift, Snowflake) fed by change data capture. This is the CQRS split that also underpins banking microservices, where each service owns its data and the ledger service is the only writer of postings.
Reconciliation built into the schema
Reconciliation proves the database agrees with itself and with the outside world, and it is easier when the schema stores the references needed to match. Three checks run every day:
- Internal integrity: debits equal credits per currency across the whole ledger (the trial balance), and every cached balance equals the sum of its postings.
- External match: postings against bank, scheme and provider statements (camt.053, card clearing files, provider reports), matched on external references stored at write time.
- Safeguarding: for an EMI or payment institution, total customer funds in the ledger against the balance of the safeguarding account at the bank, for example at ClearBank or Modulr.
Unmatched items land in a suspense account with an owner and an ageing report, never in a silent adjustment. Safeguarding reconciliation is a regulatory duty for e-money and payment firms in the UK and EU, so the posting model should make the required figure a single query. If you are applying for an authorisation, the payment institution licence guide explains what regulators expect to see.
Backup, audit and regulatory data retention
Regulators set minimum retention periods, and the database has to keep old data queryable without slowing current writes. In the EU, AML rules require customer due diligence records and transaction records to be kept for five years after the business relationship ends or the transaction is carried out (Directive (EU) 2015/849, art. 40, carried into the 2024 AML Regulation); in the UK the Money Laundering Regulations 2017 (reg. 40) set the same five years. Member states and supervisors can extend this, and tax or company law often asks for longer, so most firms design for ten years.
| Requirement | Implementation approach |
|---|---|
| Immutable audit trail | Append-only ledger enforced by database permissions. A separate audit log records who changed reference data and when (old and new values). |
| Retention (5 years minimum) | Partition postings by month. Detach old partitions to cheaper storage that stays queryable; delete only when every applicable period has passed. |
| Backup and recovery | Point-in-time recovery from WAL archives, daily full backups, restore tests on a schedule. RTO and RPO written into the business continuity plan. |
| PII protection | Encrypt sensitive columns (IBAN, document numbers) with keys held in a KMS or HSM, mask data outside production. See key management in banking. |
| Access control | Row-level security for tenants, read-only roles for reporting, logged and time-limited DBA access. |
Since January 2025 DORA also applies to EU payment and e-money institutions: ICT incidents, backup policies and recovery tests must be documented and the database is part of that scope. The practical requirements are summarised in DORA for payment institutions. A typical setup uses synchronous replication to a standby in a second availability zone (RPO near zero) plus asynchronous copies in another region.
Build or buy: a design checklist
Designing the ledger yourself makes sense only if the ledger is your product; otherwise a core banking platform gives you the same model already tested. Whichever way you go, check the design against this list:
- Exact decimal or minor-unit amounts, with currency on every posting.
- Append-only postings enforced by database permissions; corrections as reversals.
- Balanced transactions checked before commit and in the nightly trial balance.
- Unique idempotency keys on every write API and on incoming provider webhooks.
- Separate holds table; ledger, held and available balances defined in writing.
- Booking date and value date on every posting.
- External references (UETR, end-to-end ID, provider IDs) stored for matching.
- A plan for hot internal accounts before launch, not after the first incident.
- Partitioning and retention rules per data type; KYC results from providers such as Sumsub kept with their check date.
- Reporting and AML queries off the primary, through replicas or CDC.
Where Crassula fits
Crassula gives EMIs, payment institutions and fintechs a ready ledger, so the team configures products instead of designing tables. The core banking platform keeps double-entry accounts, transactions with statuses, holds and fees, multi-currency accounts and an audit trail, with integrations to banks, FX and KYC providers through connectors. The core banking system guide explains how those modules fit together.
Pricing is public: EUR 20,000 setup plus EUR 8,000 per month, with all modules included (see pricing). If you are deciding between building your own ledger and using a platform, book a demo and we will walk through the data model with your engineers.
FAQ
Start with the ledger: customer, product, account, transaction and posting tables, with postings append-only and balanced per transaction. Use exact decimal types, enforce constraints in the database and give every write an idempotency key. Keep holds separate from postings, and send reporting and analytics to replicas or a warehouse so they never compete with payments.
Large incumbent banks still run cores on IBM Db2 or IMS mainframes and on Oracle. Most fintechs, EMIs and payment institutions use PostgreSQL, often as a managed cloud service, and some high-volume or multi-region platforms use distributed SQL such as CockroachDB, YugabyteDB or Google Spanner. The ledger almost always sits in a relational, ACID database.
Customer, product, account, transaction and posting (ledger entry) are the core. Around them sit holds, fees, limits, KYC checks, beneficiaries, cards and an audit log. Classroom ER diagrams add branch, employee and loan tables, but a fintech ledger is organised around money movement rather than the bank's org chart.
Because every movement then has a matching opposite entry, and the postings of each transaction sum to zero. Money cannot appear or disappear without breaking that rule, so any error shows up in the trial balance. It also makes the same data usable for customer statements and the bank's own accounts.
Update the cached balance in the same database transaction that inserts the postings, with a row lock or a version check so two payments cannot spend the same money. Then run a daily job that recomputes each balance from the postings and flags any difference. For very busy internal accounts, skip the cached balance and compute it from postings or snapshots.
The ledger balance is the sum of posted entries. The available balance is the ledger balance minus holds (such as card authorisations not yet cleared) plus any overdraft limit. Spending decisions use the available balance; statements and accounting use the ledger balance.
When one primary database can no longer handle peak writes after partitioning, replicas and query offloading, or when data residency forces data into separate regions. Most early-stage EMIs never reach that point. If you expect to, pick a high-cardinality shard key such as account ID and start with more shards than you need.
With a saga: a local transaction debits the sender into a transit account on shard A, a second credits the receiver on shard B, and a compensating entry reverses step one if step two fails. Every step carries the same idempotency key so retries are safe. Two-phase commit also works but adds latency and a coordinator that can fail.
Under EU AML rules and the UK Money Laundering Regulations 2017, at least five years after the transaction or the end of the customer relationship. National law, tax rules and supervisors can require longer, so many firms keep ledger data for ten years in partitioned, queryable archives.