Skip to content

Hi/Lo algorithm

A distributed identifier-allocation strategy that reserves a high-value block centrally and generates low values locally within that block.

Version
v2 · 2026-09-19 · History
Domain-specific #
4868
Domain group
Applied Sciences & Engineering
Origin domain
Computer Science & Software Engineering
Subdomain
Database Systems → Computer Science & Software Engineering
Aliases
Hi-lo key generator

Core Idea

A shared sequence supplies infrequent high values, while each application process combines its current high value with a bounded local counter to produce unique identifiers without a database round trip per object. When the local counter is exhausted the process atomically obtains a new high value, resets low and computes identifiers from the block number and within-block offset. The abstraction is therefore identified by a declared carrier, a transformation or constraint over that carrier, and an invariant that tells an analyst whether the named structure is genuinely present.

How would you explain it like I'm…

Page and Sticker Numbers

Imagine a teacher hands each kid a page number now and then. Each kid then numbers their stickers on that page 1, 2, 3 up to 10 all by themselves. When a kid runs out, they ask for a new page. No two stickers ever get the same label, and the teacher isn't bothered for every sticker.

Grab a Block, Count Inside

The Hi/Lo algorithm is a trick computer programs use to give every saved thing a unique ID number. Asking the database for each number would be slow. So a program asks a shared counter for a 'high' number only once in a while, then counts 'low' numbers itself, like 0, 1, 2, up to a limit. The ID is made by combining the high and the low numbers. When the low count runs out, the program grabs a fresh high number and starts low over again.

Block-Based ID Generation

The Hi/Lo algorithm generates unique identifiers without a database round trip per object. A shared sequence hands out 'high' values, and each must be obtained atomically so no two processes get the same one. Each process then counts a local 'low' value up to a fixed block size, and computes an ID from the block number and the offset within the block, for example high × block size + low. When low is used up, the process grabs a new high and resets low. Because each high is handed out once, blocks never overlap, so IDs stay unique, though gaps appear if a process crashes or never uses its whole block.

 

The Hi/Lo algorithm is an identifier-generation scheme for database-backed applications. A shared, atomic allocator (often a database sequence or table) supplies high values infrequently. Each application process holds its current high value and a bounded local low counter. Identifiers are computed from the block number (high) and within-block offset (low), so each high value reserves a disjoint block of IDs. When low reaches its maximum, the process atomically obtains a new high value and resets low. Uniqueness follows from the atomicity of the high allocation and the fixed block size, which must be consistent across all concurrent generators. Unused portions of blocks, such as after a crash or restart, leave gaps, so IDs are unique but not contiguous. A full specification states the allocator, block size, initial values, formula and range, rollover rule, generator scope and crash behavior.

Scope of Application

Hi/Lo algorithm belongs to database systems and is useful where the analyst can specify the typed database systems carrier, including its objects, relations, parameters, conventions, evidence, boundary cases, and comparison targets, then evaluate the shared high-value allocator and atomicity, maximum low or block size, initial values, identifier formula and range, rollover rule, concurrent generator scope, gaps and crash behavior and uniqueness argument are explicit. The scope is broad within that domain but bounded by the need for the shared high-value allocator and atomicity, maximum low or block size, initial values, identifier formula and range, rollover rule, concurrent generator scope, gaps and crash behavior and uniqueness argument are explicit.

Clarity

The abstraction clarifies a crowded vocabulary by making the shared high-value allocator and atomicity, maximum low or block size, initial values, identifier formula and range, rollover rule, concurrent generator scope, gaps and crash behavior and uniqueness argument are explicit the center of the account. A claim should name the carrier, the governing operation or relation, the applicable assumptions, and the recognition test.

Manages Complexity

Without the abstraction, an analyst must reason directly over many local details: the carrier roles, admissibility assumptions, competing conventions, derived invariants, boundary cases, and proof or validation obligations specific to Hi/Lo algorithm. Hi/Lo algorithm compresses them into the roles in the structural signature. That compression permits comparison across instances without erasing the variables that determine validity. It also exposes which details may be varied safely and which are constitutive.

Abstract Reasoning

  1. Identify the carrier. State what the elements, states, objects, or observations are: the typed database systems carrier, including its objects, relations, parameters, conventions, evidence, boundary cases, and comparison targets. Reject examples whose alleged carrier belongs to a different problem.
  2. Lock the constitutive rule. Express the shared high-value allocator and atomicity, maximum low or block size, initial values, identifier formula and range, rollover rule, concurrent generator scope, gaps and crash behavior and uniqueness argument are explicit independently of one notation or implementation.

Knowledge Transfer

Knowledge transfers strongly among subfields of database systems because they reuse the typed database systems carrier, including its objects, relations, parameters, conventions, evidence, boundary cases, and comparison targets, When the local counter is exhausted the process atomically obtains a new high value, resets low and computes identifiers from the block number and within-block offset., and type the carrier, state every parameter and convention in the definition, test that the shared high-value allocator and atomicity, maximum low or block size, initial values, identifier formula and range, rollover rule, concurrent generator scope, gaps and crash behavior and uniqueness argument are explicit, compare the nearest accepted identity, and report counterexamples, uncertainty, and limiting cases.

Relationships to Other Abstractions

Local relationship map for Hi/Lo algorithmParents appear above the current abstraction, mutual partners to the right, and children below. Node labels state whether each abstraction is prime or domain-specific; colors identify relation types.Hi/Lo algorithmDOMAINPrime abstraction: Chunking — is a kind ofChunkingPRIME

Current abstraction Hi/Lo algorithm Domain-specific

Parents (1) — outgoing typed relations

  • Hi/Lo algorithm is a kind of Chunking Prime

    It remains its own entry because its identity is fixed by the shared high-value allocator and atomicity, maximum low or block size, initial values, identifier formula and range, rollover rule, concurrent generator scope, gaps and crash behavior and uniqueness argument.

Hierarchy paths (3) — routes to 3 parentless roots

Neighborhood in Abstraction Space

Hi/Lo algorithm sits in a crowded region of the domain-specific corpus (27th percentile for distinctiveness): several abstractions share nearly its structure, so a description that fits it tends to fit its neighbors too.

Family — Relational Database Theory (13 abstractions)

Nearest neighbors

Computed from structural-signature embeddings · 2026-10-25