Object database

Also known as: object-oriented database

On this page 7

An object database, also called an object-oriented database, is a database management system that stores data as persistent objects with their own identity, attributes, references and class definitions, in the same shape that an object-oriented program uses in memory. Database models differ mainly in how they represent structure and relationships, and the object model represents them as direct references between objects instead of rows linked by foreign keys.

In the field of databases, the object database emerged in the late 1980s to remove the impedance mismatch between object-oriented languages such as C++, Smalltalk and Java and the tabular relational model. It remains a specialized choice today, valued in engineering design, telecommunications, simulation and embedded systems where object graphs are deep, navigation is frequent and the schema follows the code.

How an object database stores and retrieves objects

An object database persists objects together with an object identifier (OID) that stays constant for the lifetime of the object, independent of its attribute values. When one object refers to another, the database stores the OID rather than a copied key, so a program can follow references by navigation instead of executing joins.

Most implementations use a client cache and a technique called pointer swizzling: when an object is loaded, stored OIDs are converted into in-memory pointers, and they are converted back when the object is written. The result is that traversing a reference to an already cached object costs about as much as dereferencing an ordinary pointer, which explains the strong performance on navigational workloads.

Persistence is usually achieved through one of several mechanisms. The following table summarizes the common approaches and their practical consequences.

MechanismHow objects become persistentPractical consequence
Persistence by reachabilityAny object reachable from a named root is storedLittle code, but accidental retention is possible
Persistence by inheritanceClasses derive from a persistent base classExplicit, but couples domain classes to the product
Explicit store callsThe program calls store or delete on each objectClear control, more boilerplate
Bytecode enhancementA build step instruments classes to track changesTransparent dirty tracking, extra build tooling
Persistence mechanisms in object databases

Core features of the object data model

The object data model carries the full vocabulary of object-oriented programming into storage. Its defining features were codified in the Object-Oriented Database System Manifesto of 1989 and later in the ODMG standard, which specified the Object Definition Language (ODL) and the Object Query Language (OQL).

FeatureMeaning in storageBenefit
Object identityEach object has an OID independent of its valuesStable references without surrogate keys
Complex objectsNested collections, lists, sets and arrays are stored nativelyNo decomposition into many tables
InheritanceSubclasses are stored and queried with their superclassPolymorphic queries over a class hierarchy
EncapsulationBehavior is defined by class methodsBusiness rules travel with the data type
VersioningSome systems keep versions of objects or schemasUseful for design and configuration history
Defining features of the object data model

Querying works in two styles. Navigational access starts from a root or an index and walks references, while declarative queries in OQL or a vendor language filter collections by attribute values. Mature products also provide ACID transactions, page or object locking, indexes on class extents and online backup, so the model is not limited to in-process persistence.

How the object model compares with other database models

The object database is best understood against its neighbors. It shares the schema-follows-code idea with the document database and the relationship-first idea with the graph database, but differs from both in how tightly it binds storage to a programming language.

ModelUnit of storageRelationshipsTypical query style
Object databaseTyped object with OIDDirect object referencesNavigation and OQL-style queries
Relational databaseRow in a tableForeign keys resolved by joinsSQL
Document databaseSelf-contained JSON or BSON documentEmbedding or manual referencesDocument query API
Graph databaseNode and edge with propertiesFirst-class edgesPattern matching languages
Object-relational mappingRows mapped to classes by a libraryJoins hidden behind objectsSQL generated from objects
Object database compared with related models

The comparison with object-relational mapping (ORM) matters most in practice. ORM frameworks gave relational systems an object interface, which absorbed much of the demand that object databases once targeted. Separately, object-relational databases such as PostgreSQL added user-defined types, inheritance and composite values to SQL, offering some object features while keeping a relational core.

When an object database is a sound choice

An object database fits when the domain model is a deep, interconnected object graph that one application owns and traverses frequently. It fits poorly when many applications, reporting tools and analysts must query the same data in ad hoc ways.

SituationRecommended choiceReason
CAD or product structure with thousands of nested partsObject databaseFast traversal of part-of hierarchies
Embedded device with a single language runtimeEmbedded object databaseSmall footprint, no mapping layer
Enterprise reporting across many teamsRelational databaseBroad SQL tooling and analytics support
Highly connected data queried by patternGraph databaseEdges and path queries are first-class
Web service storing flexible JSON payloadsDocument databaseLanguage-neutral format and wide ecosystem
Decision guide for the object model

Teams evaluating the model should benchmark realistic traversal depths, check whether the product supports the languages they use, and confirm how the vendor handles schema evolution, because class changes are the most frequent operational event in an object database.

Limitations and common mistakes

The main weakness of the object database is tight coupling to one language and often to one vendor. Data stored as Java objects is not easily read by a Python service or a business intelligence tool, and the ODMG standard never achieved real portability between products.

  • Ignoring schema evolution: renaming or splitting classes without a migration plan can leave stored objects unreadable.
  • Loading whole graphs: careless reachability or eager activation can pull millions of objects into memory.
  • Treating it as a reporting store: ad hoc aggregation is weaker than in SQL engines and needs exported data.
  • Underestimating skills risk: fewer administrators and developers know the products, which raises long-term maintenance cost.
  • Assuming universal speed: set-oriented scans and bulk updates are often slower than in a tuned relational system.

A balanced view is that the object database delivers excellent navigational performance and a natural programming model in exchange for reduced interoperability. That trade-off explains why it survives in specialized niches rather than as a general-purpose default.

A plain-language summary

Most programs think in terms of objects: a customer, an order, an engine part. A traditional database stores tables instead, so the program must constantly take objects apart and put them back together. An object database saves the objects as they are, including the links between them.

Think of a cabinet where every folder can hold direct pointers to other folders. To find what an engine part connects to, the program simply follows those pointers. The key takeaway is that this approach is fast and natural for one program with complex data, but harder to share with other tools and languages.

An example from practice

An engineering team builds software that manages the design of industrial pumps. Each pump model contains assemblies, each assembly contains around 200 parts, and parts reference materials, suppliers and tolerances. A single model can reach about 50,000 interconnected objects, and engineers open, edit and compare models all day.

With a relational schema, opening one model required dozens of joins and a mapping layer that took several seconds. The team moved the design store to an embedded object database, storing assemblies and parts as persistent objects with direct references and an index on the part number.

Opening a model became a matter of loading the root object and navigating references from a local cache, and response times fell to well under a second for typical edits. For monthly cost reports, the team exports a flattened copy to a relational warehouse, which keeps analytics in SQL while the design tool keeps its object model.