Skip to main content

Scalar Data Types

Aerospike records have one or more bins. Each bin will hold a distinct scalar data type, such as Integer or String, a collection data type, such as List or Map, a probabilistic data type such as HyperLogLog, or a geospatial GeoJSON data type. (In some portions of the Aerospike documentation and in some messages, a scalar data type is called a "particle".)

The following are scalar data types:

Integer

Integers are 64-bit numeric values.

  • Each integer requires 8 bytes (64 bits) of storage.
  • For touchpoints in the database where integers need to assume a signed-ness, such as secondary index, the integer is signed, in the range of [ −(2^63) to 2^63 − 1 ].
  • An atomic increment operation can be applied to integer values. This can be used to implement counters.
  • Secondary indexes are supported on integer data type, for both equality and range queries.

Double

The double data type is stored in 64-bit IEEE-754 format.

  • An atomic increment operation can be applied to double values.
  • Support for the double data type added in Aerospike versions 3.6.0.

String

Strings are opaque byte arrays. They are not bound to an encoding, which allows you to use any character encoding for strings.

  • For touchpoints in the database where strings need to assume an encoding, it will assume UTF-8.
  • Client libraries can enforce encoding (for example, Java and C# clients always convert to UTF-8). Refer to the client library for your implementation.
  • Cross-language compatibility is up to the application. The application sets encoding for reads and writes reads.
  • Record size is limited to 128 KB. Do not store huge strings.
  • Atomic prepend and append operations can be applied to string values.
  • Secondary indexes are supported on string data type, for equality query.

Boolean

The boolean data type holds a value of either true or false.

  • Stored as a single byte on the server.
  • Support for boolean bin values added in Aerospike version 5.6.0.
  • Prior to version 5.6.0 only the List and Map data types could contain boolean values.

Blob/Bytes

Blobs are byte arrays of a specific size.

  • Any binary data of any type can be stored. Note that bytes are not NULL terminated.
  • As of version 4.6.0, an extensive API of bitwise operations can be applied to byte values.

Language-Specific Serialized Blobs

Using their native-language serialization mechanism, the following Aerospike clients serialize unsupported data types into blobs. These blobs are deserialized automatically on reads.

  • Java
  • C# .NET
  • Node.js
  • Python
  • C
  • PHP