Alexander Radzin
Posted on May 26, 2020
Introduction
My previous post has introduced to reader the Aerospike JDBC driver. This post explains one of its feature - DDL.
DDL - data definition language
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:
STRING
NUMERIC
GEO2DSPHERE
STRING MAPKEYS
STRING MAPVALUES
NUMERIC LIST
Dropping index is simpler:
DROP INDEX <set_name>.<bin_name>
For example:
DROP INDEX MYTABLE.INDEX1
Project home
The project is available in GitHub.
What's next
Next article of this series will explain the SQL DML compliance.
Previous
Posted on May 26, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.