mobilitydb_datagen

MobilityDB random data generator functions

Overview

PackageVersionCategoryLicenseLanguage
mobilitydb1.3.0GISGPL-3.0SQL
IDExtensionBinLibLoadCreateTrustRelocSchema
1650mobilitydbNoYesNoYesNoYes-
1651mobilitydb_datagenNoNoNoYesNoYes-
Relatedmobilitydb mobilitydb postgis timescaledb pgrouting

Version

TypeRepoVersionPG VerPackageDeps
EXTPGDG1.3.01817161514mobilitydbmobilitydb
DEBPGDG1.3.01817161514postgresql-$v-mobilitydb-
OS / PGPG18PG17PG16PG15PG14
el8.x86_64PGDG MISSPGDG MISSPGDG MISSPGDG MISSPGDG MISS
el8.aarch64PGDG MISSPGDG MISSPGDG MISSPGDG MISSPGDG MISS
el9.x86_64PGDG MISSPGDG MISSPGDG MISSPGDG MISSPGDG MISS
el9.aarch64PGDG MISSPGDG MISSPGDG MISSPGDG MISSPGDG MISS
el10.x86_64PGDG MISSPGDG MISSPGDG MISSPGDG MISSPGDG MISS
el10.aarch64PGDG MISSPGDG MISSPGDG MISSPGDG MISSPGDG MISS
d12.x86_64PGDG 1.3.0PGDG 1.3.0PGDG 1.3.0PGDG 1.3.0PGDG 1.3.0
d12.aarch64PGDG 1.3.0PGDG 1.3.0PGDG 1.3.0PGDG 1.3.0PGDG 1.3.0
d13.x86_64PGDG 1.3.0PGDG 1.3.0PGDG 1.3.0PGDG 1.3.0PGDG 1.3.0
d13.aarch64PGDG 1.3.0PGDG 1.3.0PGDG 1.3.0PGDG 1.3.0PGDG 1.3.0
u22.x86_64PGDG MISSPGDG 1.2.0PGDG 1.2.0PGDG 1.2.0PGDG 1.2.0
u22.aarch64PGDG MISSPGDG 1.2.0PGDG 1.2.0PGDG 1.2.0PGDG 1.2.0
u24.x86_64PGDG 1.3.0PGDG 1.3.0PGDG 1.3.0PGDG 1.3.0PGDG 1.3.0
u24.aarch64PGDG 1.3.0PGDG 1.3.0PGDG 1.3.0PGDG 1.3.0PGDG 1.3.0
u26.x86_64PGDG 1.3.0PGDG 1.3.0PGDG 1.3.0PGDG 1.3.0PGDG 1.3.0
u26.aarch64PGDG 1.3.0PGDG 1.3.0PGDG 1.3.0PGDG 1.3.0PGDG 1.3.0

Install

You can install mobilitydb directly. First, make sure the PGDG repository is added and enabled:

pig repo add pgdg -u          # Add PGDG repo and update cache

Install the extension using pig or apt/yum/dnf:

pig install mobilitydb;          # Install for current active PG version
pig ext install -y mobilitydb -v 18  # PG 18
pig ext install -y mobilitydb -v 17  # PG 17
pig ext install -y mobilitydb -v 16  # PG 16
pig ext install -y mobilitydb -v 15  # PG 15
pig ext install -y mobilitydb -v 14  # PG 14
apt install -y postgresql-18-mobilitydb   # PG 18
apt install -y postgresql-17-mobilitydb   # PG 17
apt install -y postgresql-16-mobilitydb   # PG 16
apt install -y postgresql-15-mobilitydb   # PG 15
apt install -y postgresql-14-mobilitydb   # PG 14

Create Extension:

CREATE EXTENSION mobilitydb_datagen CASCADE;  -- requires: mobilitydb

Usage

Sources: repository, synthetic data generator docs, control file, temporal generators, temporal point generators

mobilitydb_datagen provides PL/pgSQL functions for generating synthetic PostgreSQL, PostGIS, and MobilityDB values. It is mainly useful for regression data, demos, and benchmark fixtures that need random temporal values or trajectories.

-- After the main MobilityDB extension is loaded:
CREATE EXTENSION mobilitydb_datagen;

Generating Random Temporal Values

-- A random temporal float sequence.
SELECT random_tfloat_seq(
    -100.0, 100.0,                                  -- value bounds
    '2025-06-01 00:00+00', '2025-06-02 00:00+00',  -- time bounds
    10.0,                                           -- max value delta
    10,                                             -- max minutes between instants
    5, 10                                           -- min/max instants
);

-- Step interpolation instead of the default linear interpolation.
SELECT random_tfloat_seq(
    -100.0, 100.0,
    '2025-06-01 00:00+00', '2025-06-02 00:00+00',
    10.0, 10, 5, 10,
    false
);

-- A random temporal geometry point sequence.
SELECT asEWKT(
    random_tgeompoint_contseq(
        2.20, 2.50, 48.80, 48.95,                  -- x/y bounds
        '2025-06-01 08:00+00', '2025-06-01 18:00+00',
        0.02, 5, 20, 40,                           -- max delta, max minutes, min/max instants
        srid => 4326
    )
);

Other confirmed generator families include scalar helpers such as random_bool, random_int, random_float, random_text, and random_timestamptz; array, set, span, and range helpers; temporal helpers such as random_tbool_inst, random_tint_discseq, random_tfloat_seq, and random_tfloat_seqset; and spatial/temporal-point helpers such as random_geom_point, random_geom_linestring, random_tgeompoint_contseq, random_tgeompoint_seqset, random_tgeogpoint_contseq, and random_tgeogpoint_seqset.

Generating Test Datasets

Create bulk test data for benchmarking trip queries:

CREATE TABLE trip_samples AS
SELECT
    vehicle_id,
    random_tgeompoint_contseq(
        2.20, 2.50, 48.80, 48.95,
        '2025-06-01 08:00+00', '2025-06-01 18:00+00',
        0.02, 5, 20, 40,
        srid => 4326
    ) AS trip
FROM generate_series(1, 1000) AS vehicle_id;

Caveats

  • The control file requires the main mobilitydb extension; mobilitydb_datagen is not standalone.
  • The package row in db/extension.csv lists version 1.3.0, package mobilitydb, and PostgreSQL support for 14 through 18.
  • Upstream docs intentionally omit detailed parameter lists for many generator functions and point users to the SQL source files for exact signatures.

Last Modified 2026-05-18: routine extension update (cfff783)