Object-relational database

Also known as: ORDBMS

On this page 7

An object-relational database (ORDBMS) is a database management system that keeps the relational model of tables, rows and SQL but extends it with user-defined data types, type inheritance, complex attributes and server-side methods. Among the classic database models in databases, it sits between the pure relational system and the object database, offering object-oriented modeling power without giving up declarative queries, transactions and mature tooling.

The idea took shape in the late 1980s and early 1990s, most visibly in the Postgres research project, and the SQL:1999 standard later codified much of it as structured types, typed tables and reference types. Today the clearest practical examples are PostgreSQL, Oracle Database with its object types and IBM Db2, although each implements a different subset of the standard.

How an object-relational database extends SQL

An object-relational database works by letting the type system of the database be extended rather than fixed. A developer can declare a new type, attach functions and operators to it, teach the query planner how to index it and then use it in columns exactly like a built-in integer or text value.

The core extension mechanisms are few but powerful. Composite types group several fields into one value, arrays store ordered collections inside a single column, domains add constraints to a base type, and table inheritance lets a child table reuse the columns of a parent. Behavior is added through user-defined functions written in SQL or procedural languages, and through custom index access methods such as GiST or GIN in PostgreSQL.

The following table maps the main object-oriented concepts to their object-relational counterparts.

ConceptObject-relational mechanismTypical syntax or feature
Class or recordStructured or composite typeCREATE TYPE ... AS (...)
InheritanceType or table inheritanceUNDER in SQL:1999, INHERITS in PostgreSQL
MethodUser-defined function bound to a typeCREATE FUNCTION, member methods in Oracle
CollectionArray, nested table or multisetinteger[], VARRAY, MULTISET
Object identityReference type or surrogate keyREF types, object identifiers
EncapsulationPartial, through functions and viewsAccess via functions, privileges on columns
Object-oriented concepts and their object-relational form

Key features and extension types

The value of an ORDBMS comes from domain-specific types that the engine understands natively. Instead of storing a polygon as text and parsing it in the application, the database stores a geometry type, evaluates spatial predicates and uses a spatial index to answer queries efficiently.

This extensibility is why ecosystems such as PostGIS for geospatial data, full-text search types, range types and JSON document types grew on top of an object-relational core. The table below summarizes common extension categories and what each adds to the relational engine.

Extension typeWhat it addsExample use
Spatial typesGeometry, geography and spatial operatorsFinding stores within 5 km
Range typesIntervals with overlap and containment operatorsPreventing double room bookings
Document typesSemi-structured JSON with indexingStoring variable product attributes
Full-text typesToken vectors and ranked searchSearching article bodies
Vector typesEmbeddings with similarity operatorsNearest-neighbor retrieval
Custom scalar typesDomain values with validationCurrency, ISBN or IP address columns
Common extension categories in object-relational systems

A crucial detail is that these types participate in the cost-based query optimizer. Operator classes tell the planner which indexes can serve which predicates, so a well-designed extension behaves like a first-class part of SQL rather than a slow add-on.

The object-relational database differs from neighboring models mainly in where object semantics live and how data is queried. A pure relational system keeps types simple and pushes structure into normalized tables, while an object database stores persistent objects and navigates them through pointers from a programming language.

The comparison below places the ORDBMS among the models it is most often confused with.

ModelData representationQuery styleTypical strength
Relational databaseFlat tables of atomic valuesDeclarative SQLSimplicity and portability
Object-relational databaseTables with rich, extensible typesSQL plus type methods and operatorsComplex domains with SQL guarantees
Object databasePersistent objects and referencesNavigational access, OQLTight fit with one language
Document databaseNested JSON-like documentsDocument query APIsFlexible schemas
Multi-model databaseSeveral models in one engineSeveral query languagesConsolidating workloads
How the object-relational model compares with neighboring models

It is also distinct from an object-relational mapper (ORM). An ORM is application-side software that translates classes into plain relational tables; an ORDBMS moves part of that object modeling into the database engine itself, so the database enforces and indexes the richer structures.

When to choose an object-relational design

An object-relational approach pays off when the domain has complex value types that must be queried efficiently in the database. It is less useful when data is simple, highly normalized and accessed only through basic lookups.

SituationRecommended choiceReason
Spatial or temporal queries at scaleNative spatial or range typesIndexes evaluate predicates in the engine
Small set of repeated value groupsComposite types or domainsConsistent validation in one place
Deep class hierarchies from the applicationSeparate tables or ORM mappingTable inheritance has constraint gaps
Need for portability across vendorsStandard relational tablesObject features differ between products
Highly variable attributesDocument column inside relational tablesCombines flexibility with joins
Decision guide for object-relational features

In practice, teams use selected object-relational features rather than the full paradigm. A schema may stay mostly relational while relying on arrays, a JSON column and a spatial type exactly where they reduce application complexity.

Limitations and common mistakes

The main weakness of the object-relational model is uneven and vendor-specific implementation. The SQL:1999 object features were adopted only partly, so a schema that relies heavily on structured types in Oracle Database rarely ports cleanly to PostgreSQL or Db2.

  • Table inheritance pitfalls: in PostgreSQL, unique constraints and foreign keys on a parent table do not cover rows stored in child tables.
  • Overusing arrays: storing related entities in an array column breaks referential integrity and makes joins and updates harder.
  • Opaque logic in functions: business rules hidden in server-side methods can be difficult to test, version and debug.
  • Tooling gaps: reporting tools, drivers and ORMs may not understand custom types without extra mapping.
  • Assuming full encapsulation: unlike true objects, attributes usually remain directly readable through SQL.

A sound rule is to adopt an extension only when the engine can index and optimize it, and to keep core entities in normalized tables so that integrity constraints continue to work as expected.

Stripped to the essentials

A normal relational database is like a spreadsheet where each cell holds a simple value, such as a number, a date or a short text. An object-relational database keeps the spreadsheet idea but lets cells hold richer, purpose-built values, such as a map shape, a time range or a list.

Just as important, the database knows how to work with those values. It can tell whether two time ranges overlap or whether a point lies inside an area, and it can do so quickly. The key takeaway is that you keep the reliability of SQL while gaining tools that fit complicated real-world data.

Where it is applied

A regional delivery company stores depots, customer addresses and delivery zones in PostgreSQL with the PostGIS extension. Each address has a geography column, and each zone is a polygon. A single SQL query finds all orders placed in the last hour whose address lies inside a zone and within 8 km of the nearest open depot.

Because a spatial index serves the containment and distance predicates, the query scans only a small fraction of roughly two million addresses and returns in well under a second. The same table also uses a range type to block overlapping driver shifts. The outcome is one consistent database instead of a relational store plus a separate geographic service, with fewer synchronization errors and simpler code.