SECONDO

Getting Started

This guide walks you through a "do it yourself" demo of Secondo, the moving objects database system. In about 15–20 minutes you will install Secondo, restore an example database, and run queries that compute the trajectory of a moving underground train, find all trains passing through a region, and see the query optimizer in action — without having to read any manuals or papers first.

What is a Moving Object?

Secondo can represent and query complete histories of movement. A trip taken by a vehicle can be stored as a single value of type moving point (mpoint for short), and the spread of a forest fire over time can be stored as a single value of type moving region (mregion). A moving point is essentially a function from time into point values, and a moving region a function from time into region values; they can be visualized as shown below.
A moving point visualized as a curve and a moving region visualized as a stack of cross-sections over the x, y, t axes
Together with these data types, Secondo provides operations to query and manipulate them, for example:
Operation Signature Meaning
trajectory mpoint → line the 2D projection of a moving point
distance mpoint × point → mreal time-dependent distance between a moving point and a static point
passes mpoint × region → bool whether a moving point ever passes through a given area
inside mpoint × mregion → mbool time-dependent boolean indicating when the point is inside the moving region
This approach to modeling and querying moving objects is described in a series of papers and in the textbook Moving Objects Databases (Morgan Kaufmann, 2005); see the Publications page for details.

Step 1: Install SECONDO

If you do not yet have a Secondo installation, the fastest way to try it is the official container image. It bundles everything you need, so no local build is required:
docker run -d --name secondo -p 8000:8000 -p 1234:1234 \
    -v secondo-databases:/var/lib/secondo/databases \
    ghcr.io/secondo-database/secondo:latest
This gives you the Secondo WebUI in your browser at http://localhost:8000; you can skip ahead to Step 4. If you would rather install Secondo natively (Ubuntu .deb packages, building from source, or macOS via Homebrew), see the full Installation Instructions page and then come back here.

Step 2: Restore the Example Database

  1. Open a shell and change to the secondo/bin directory (skip this step for the Ubuntu .deb or container installation, where the Secondo commands are available from any directory):
    cd secondo/bin
  2. Start a single-user session:
    ./SecondoTTYBDB
  3. Restore the example database used in this guide, then quit:
    restore database berlintest from berlintest;
    close database;
    q
    In the Ubuntu .deb installation, the database files live in /opt/secondo/bin, so use instead:
    restore database berlintest from '/opt/secondo/bin/berlintest';
    A command at this interface is terminated by either a semicolon or an empty line.

Step 3: Start the Kernel and the WebUI

  1. Still in secondo/bin, start the kernel process that user interfaces connect to:
    ./SecondoMonitor -s
  2. Open a new shell, change to secondo/WebUI (not needed for the .deb or container installation), and start the WebUI:
    make venv native
    make prod
    After the command make prod has finished, the WebUI is available in your browser at http://localhost:8000.
  3. In the database and catalog view at the left of the WebUI, open the berlintest database. Alternatively, you can also use the command line in the WebUI to open the database:
    open database berlintest

Step 4: Run Your First Queries

  1. To load the underground network of Berlin as a background, type:
    query UBahn
    Or click on the UBahn entry in the catalog view at the left. The network appears in the main view.
    Secondo WebUI showing the Berlin underground network
    The Berlin underground network appears — we will use it as a background for the moving trains stored in the relation Trains(Id: int, Line: int, Up: bool, Trip: mpoint), which holds 562 trains moving on 2003‑11‑20.

    You can adjust the color and the width of the lines by clicking on the UBahn layer on the top right and adjusting it.
  2. The coordinates of the berlintest database are non-standard WGS 84 coordinates. To map them and be able to get a map background, click on the projection dropdown on the top left and select BerlinMOD -> OSM.
    The Berlin underground network overlaid on an OpenStreetMap background
    Map data © OpenStreetMap contributors
  3. Look at a single train, a value of type mpoint:
    query train7
    Use the animation "forward" button to see it move along its trajectory. You can also adjust the speed or pause the animation. Furthermore, you can change the symbol of the train by clicking on the train7 layer on the top right and adjusting it.
    Train7 shown as a moving point on the map, mid-animation along its route
    Map data © OpenStreetMap contributors
  4. Compute the path train7 has taken:
    query trajectory(train7)
    The width and the color of the line can be adjusted by clicking on the trajectory(train7) layer.
    The full trajectory of train7 drawn as a line on the map
    Map data © OpenStreetMap contributors
  5. Compute the time-dependent distance between train7 and the underground station mehringdamm:
    query mehringdamm
    then
    query distance(train7, mehringdamm)
    On the left, you will see a value of type mreal, which is a time-dependent real number. It represents the distance between the train and the station over time; it drops to 0 when train7 passes through the station.
    Plot of the time-dependent distance between train7 and the mehringdamm station, dropping to zero as the train passes through
    Map data © OpenStreetMap contributors
  6. Find all trains passing through the static region tiergarten:
    query Trains count
    query Trains feed filter[.Trip passes tiergarten] count
    query Trains feed filter[.Trip passes tiergarten] consume
    This confirms 562 trains in total, of which 80 pass through tiergarten, and then displays them.
  7. You can clear the query results by clicking on the X button in the layers panel.

Step 5: Use the Query Optimizer

  1. SQL-style queries can be used as well. Find how many trains pass through mehringdamm:
    select count(*) from Trains where Trip passes mehringdamm
    The first optimizer query takes a little longer while it initializes; the result is 122. See the individual trains with:
    select * from Trains where Trip passes mehringdamm
  2. Also more complex queries can be optimized, not just on moving objects. The berlintest database also contains restaurants and sights of interest in Berlin. Find the names and addresses of all Italian restaurants within 2 km of the Brandenburg Gate:
    select [r:name, r:strasse, r:geoData]
    from   [restaurants as r, sehenswuerdpoi as s]
    where  [ s:name="Brandenburger Tor",
             r:art="Italienisch",
             distance(r:geoData, s:geodata) < 2000]
    Secondo GUI showing Italian restaurants near the Brandenburg Gate plotted on a map of Berlin
    Map data © OpenStreetMap contributors

Where to Go Next

Related Papers, Book

The spatio-temporal data model implemented by Secondo is described in the following papers and in the textbook Moving Objects Databases. See the Publications page for further Secondo-related papers.
  1. M. Erwig, R.H. Güting, M. Schneider, and M. Vazirgiannis Spatio-Temporal Data Types: An Approach to Modeling and Querying Moving Objects in Databases GeoInformatica 3:3 (1999), 269-296.
  2. R.H. Güting, M.H. Böhlen, M. Erwig, C.S. Jensen, N.A. Lorentzos, M. Schneider, and M. Vazirgiannis A Foundation for Representing and Querying Moving Objects ACM Transactions on Database Systems 25:1 (2000), 1-42.
  3. L. Forlizzi, R.H. Güting, E. Nardelli, and M. Schneider A Data Model and Data Structures for Moving Objects Databases Proc. ACM SIGMOD Conf. (Dallas, Texas), May 2000, 319-330.
  4. J.A. Cotelo Lema, L. Forlizzi, R.H. Güting, E. Nardelli, and M. Schneider Algorithms for Moving Objects Databases The Computer Journal 46:6 (2003), 680-712.
  5. R.H. Güting and M. Schneider Moving Objects Databases Morgan Kaufmann Publishers, 2005. ISBN 978-1-55860-828-3.
Last Changed: 2026-08-23