AAmit’s LibraryLEARN · PRACTISE · REFLECT

Operations and capacity × Databases

Business lens: Operations and capacity · Technology lens: Databases

Reading scope: Original fictional teaching; same-author arithmetic checks are not independent editorial validation.

A reservation changes what can be promised

A fictional wholesaler accepts orders through several sales desks. Each desk sees the same stock total, but their combined reservations can exceed available inventory. Operations and databases meet at the distinction between a displayed count and a controlled commitment. Define the stock unit, reservation state and authority to accept an order. A read of available inventory does not itself reserve it. Two users can make competing decisions from similar information unless the system coordinates the state transition. Begin with the obligation created by acceptance and specify how the record prevents or exposes conflicting commitments.

Model stock and reservation identities

Sales accepts requests, Inventory defines available units and Dispatch confirms what has actually left. Keep an order identifier distinct from a reservation event, and distinguish requested, reserved, released and cancelled quantities. A repeated message should not create a second reservation for the same unchanged obligation. Database constraints can help enforce selected structural rules, while business logic controls the intended transitions. A well-formed reservation can still refer to stock that is damaged or otherwise unavailable. Agree on reconciliation and correction ownership. Do not silently delete an accepted order to make inventory balance; record how its customer promise is revised. Record which desk created each accepted commitment and correction.

Worked commitments and physical availability

The invented import contains seventy-two reservation-event rows. Twelve repeat an already represented one-unit reservation, leaving sixty distinct one-unit commitments. Physical stock available under the exercise assumptions is fifty units, so distinct commitments exceed stock by ten. Treating all seventy-two rows as obligations would suggest a twenty-two-unit gap, but twelve are repeated events. Eight distinct commitments are then legitimately cancelled before dispatch. Remaining commitments become fifty-two, still exceeding the fifty-unit stock by two. The cancellation history remains visible. These simplified quantities assume identical usable units; they do not model product variants, safety stock, replenishment or damaged inventory.

Resolve the remaining gap openly

The two-unit shortfall needs an operational decision: an approved replenishment, a revised customer promise or another legitimate allocation rule. Deduplicating events corrects the evidence but does not produce stock. Cancelling eight obligations changes the workload only because the cancellations are genuine, not because a query filters them out. A count shown on a screen should identify its time and inclusion rule. Check what happens when another reservation arrives during reconciliation. The objective is a consistent promise and state history across desks. An accurate aggregate alone cannot ensure that each individual customer receives the correct item at the promised time.

Practice a constrained reservation ledger

Use the existing database-constraints lesson to define order, reservation event and stock records. Create the seventy-two raw rows, twelve repeats and sixty canonical commitments, then the eight legitimate cancellations. Reproduce the ten-unit initial and two-unit remaining gaps. Your portfolio should include a concurrency scenario and an explicit resolution for the final shortage without inventing inventory. This is an extension of existing bounded practice, not a newly executed concurrent database test or production reservation service. If you implement the ledger locally, retain actual query outputs and correction events separately from the stipulated expected counts.

Enquiry and four levels

Who accepts the obligation, and Whom should Sales consult about usable stock? Whose reservation is cancelled? What is canonical commitment, Where is availability checked, and When does it become reserved? Why is reading not reserving? Which repeat must be reconciled? How is the final gap resolved? Foundation learners distinguish stock and promise. Undergraduate learners calculate canonical commitments and shortages. Postgraduate learners critique concurrent decisions, variants and correction authority. DBA/research learners investigate a bounded reservation-control mechanism with declared transitions and observed outcomes. For revision, explain why removing twelve repeated events changes the apparent gap without adding twelve units of stock, and why eight real cancellations still leave a two-unit shortfall under the exercise assumptions.

Study questions and answers

What is the initial genuine shortage?

72−12 = 60 distinct commitments against 50 units, leaving a ten-unit shortage.

Marking guide: Credit 72−12=60 commitments and ten-unit shortage against fifty stock.

What remains after eight cancellations?

60−8 = 52 commitments against 50 units, leaving a two-unit shortage.

Marking guide: Credit 52 commitments after eight cancellations and two-unit shortage.

Why is an inventory read insufficient?

It does not itself coordinate or record a reservation; competing users can act on the same displayed availability.

Marking guide: Inventory reading does not coordinate reservation; simultaneous users can act on identical displayed availability.

Practice task

Design a canonical reservation ledger with cancellation history and an unresolved-shortage decision.

Practice bridge

  1. Design a canonical reservation ledger with cancellation history and an unresolved-shortage decision.
  2. Reproduce the worked arithmetic, change one assumption and label invented evidence separately from actual practice observations.

Open connected lab

Boundary: Original fictional exercise connected to an existing bounded or guided lesson. No new executable fixture, external platform execution or catalogue lab claimed.

Related chapters

Interactive practice

Open workshop · Open runnable practice · Open lab lab-15

Open interactive matrix reading