Database Query API

Compatibility note: this documentation applies to ELKI version 0.4


Database queries are a key concept in ELKI that allows algorithms to benefit from available indexes and will in the future be used for additional optimizations. For example, a separate thread could be spawned to precompute values according to some plan, or appropriate indexes could be added automatically.

The query API works much like a “prepared statement” as you might know it from SQL. Except that instead of providing a string SQL statement with placeholders, you request a particular Java API. Of course when using a spatial SQL database as backend, a query could indeed be translated into a SQL Prepared Statement!

As there might be expensive optimizations happening, you should try to prepare a statement only rarely!

Database queries

Current queries include:

Note that the SQL paraphrases are just for understanding the queries; there usually is no SQL database available.


There are a number of “hints” to give to the database layers to optimize. Please consider which ones are appropriate for your algorithm! Note: this list is not exhaustive!