My previous post has introduced to reader the Aerospike JDBC driver. This post explains one of its feature - DDL.
Typical relational database requires schema definition. DDL commands can create schemas, tables, indexes etc. Aerospike is a schemaless database. Namespace cannot be created dynamically: it must be configured using configuration file. Aerospike set (similar to table in a relational database) should not be created explicitly: it is created automatically when data is being written.
Secondary indices exist in Aerospike as well as relational databases and can be created and dropped dynamically. Aerospike JDBC driver supports commands CREATE INDEX and DROP INDEX.
Relational database "knows" type of indexed field, so it should not be mentioned in "CREATE INDEX" statement. Aerospike is schemaless DB, so the index type is defined when index is being created:
CREATE STRING INDEX INDEX1 ON MYTABLE (SOME_FIELD)
Generally syntax of create index statement looks like
CREATE <type> INDEX <index_name> ON <set_name> (<bin_name>)
The following index types are supported:
Dropping index is simpler:
DROP INDEX <set_name>.<bin_name>
DROP INDEX MYTABLE.INDEX1
The project is available in GitHub.
Next article of this series will explain the SQL DML compliance.