Skip to content

mobilitydb_datagen

MobilityDB random data generator functions

mobilitydb : MobilityDB random data generator functions

Overview

ID Extension Package Version Category License Language
1651 mobilitydb_datagen mobilitydb 1.3.1 GIS PostgreSQL SQL
Attribute Has Binary Has Library Need Load Has DDL Relocatable Trusted
----d-r No No No Yes yes no
Pigsty 1.3.1 bundles MobilityDB DataGen; upgrading from 1.2 to 1.3 requires upstream backup/restore.

Packages

Type Repo Version PG Major Compatibility Package Pattern Dependencies
EXT PIGSTY 1.3.1 18 17 16 15 14 mobilitydb mobilitydb
RPM PIGSTY 1.3.1 18 17 16 15 14 mobilitydb_$v postgis36_$v
DEB PIGSTY 1.3.1 18 17 16 15 14 postgresql-$v-mobilitydb postgresql-$v-postgis-3
Linux / PG PG18 PG17 PG16 PG15 PG14
el8.x86_64 PIGSTY 1.3.1 PIGSTY 1.3.1 PIGSTY 1.3.1 PIGSTY 1.3.1 PIGSTY 1.3.1
el8.aarch64 PIGSTY 1.3.1 PIGSTY 1.3.1 PIGSTY 1.3.1 PIGSTY 1.3.1 PIGSTY 1.3.1
el9.x86_64 PIGSTY 1.3.1 PIGSTY 1.3.1 PIGSTY 1.3.1 PIGSTY 1.3.1 PIGSTY 1.3.1
el9.aarch64 PIGSTY 1.3.1 PIGSTY 1.3.1 PIGSTY 1.3.1 PIGSTY 1.3.1 PIGSTY 1.3.1
el10.x86_64 PIGSTY 1.3.1 PIGSTY 1.3.1 PIGSTY 1.3.1 PIGSTY 1.3.1 PIGSTY 1.3.1
el10.aarch64 PIGSTY 1.3.1 PIGSTY 1.3.1 PIGSTY 1.3.1 PIGSTY 1.3.1 PIGSTY 1.3.1
d12.x86_64 PIGSTY 1.3.1 PIGSTY 1.3.1 PIGSTY 1.3.1 PIGSTY 1.3.1 PIGSTY 1.3.1
d12.aarch64 PIGSTY 1.3.1 PIGSTY 1.3.1 PIGSTY 1.3.1 PIGSTY 1.3.1 PIGSTY 1.3.1
d13.x86_64 PIGSTY 1.3.1 PIGSTY 1.3.1 PIGSTY 1.3.1 PIGSTY 1.3.1 PIGSTY 1.3.1
d13.aarch64 PIGSTY 1.3.1 PIGSTY 1.3.1 PIGSTY 1.3.1 PIGSTY 1.3.1 PIGSTY 1.3.1
u22.x86_64 PIGSTY 1.3.1 PIGSTY 1.3.1 PIGSTY 1.3.1 PIGSTY 1.3.1 PIGSTY 1.3.1
u22.aarch64 PIGSTY 1.3.1 PIGSTY 1.3.1 PIGSTY 1.3.1 PIGSTY 1.3.1 PIGSTY 1.3.1
u24.x86_64 PIGSTY 1.3.1 PIGSTY 1.3.1 PIGSTY 1.3.1 PIGSTY 1.3.1 PIGSTY 1.3.1
u24.aarch64 PIGSTY 1.3.1 PIGSTY 1.3.1 PIGSTY 1.3.1 PIGSTY 1.3.1 PIGSTY 1.3.1
u26.x86_64 PIGSTY 1.3.1 PIGSTY 1.3.1 PIGSTY 1.3.1 PIGSTY 1.3.1 PIGSTY 1.3.1
u26.aarch64 PIGSTY 1.3.1 PIGSTY 1.3.1 PIGSTY 1.3.1 PIGSTY 1.3.1 PIGSTY 1.3.1

Source

pig build pkg mobilitydb;		# build rpm/deb

Install

Make sure PGDG and PIGSTY repo available:

pig repo add pgsql -u   # add both repo and update cache

Install this extension with pig:

pig install mobilitydb;		# install via package name, for the active PG version
pig install mobilitydb_datagen;		# install by extension name, for the current active PG version

pig install mobilitydb_datagen -v 18;   # install for PG 18
pig install mobilitydb_datagen -v 17;   # install for PG 17
pig install mobilitydb_datagen -v 16;   # install for PG 16
pig install mobilitydb_datagen -v 15;   # install for PG 15
pig install mobilitydb_datagen -v 14;   # install for PG 14

Create this extension with:

CREATE EXTENSION mobilitydb_datagen CASCADE; -- requires mobilitydb

Usage

Sources:

mobilitydb_datagen 1.3.1 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 generator is distributed with mobilitydb version 1.3.1. Keep the dependency and generator files aligned; build flags and package availability determine which optional type families are present.
  • Upstream docs intentionally omit detailed parameter lists for many generator functions and point users to the SQL source files for exact signatures.

The generator functions create synthetic values, not reproducible application datasets by default. Set a deliberate random seed when comparing runs, and review bounds, time zones, interpolation, and SRID for the workload.