Skip to content

Scalar data types

For the complete documentation index see: llms.txt

All documentation pages available in markdown.

This page describes Aerospike scalar data types, such as Integer, Double, String, Boolean, and Blob/Bytes, including storage size, atomic operations, and secondary index compatibility.

Aerospike records have one or more bins. Each bin holds a distinct scalar data type such as Integer or String, a collection data type (CDT) such as List or Map, a probabilistic data type such as HyperLogLog, or a geospatial GeoJSON data type.

Scalar data types

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 types, 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.

String

String bins store a sequence of bytes tagged as String (not Blob). On ordinary reads and writes, the server does not validate which character encoding those bytes represent.

Starting in Aerospike Database 8.2.0, string operations and String expressions require valid UTF-8 in the String bin and in operation arguments. Plain put writes still allow invalid UTF-8, but string operations on that bin return AS_ERR_INVALID_ENCODING until the data is repaired. For validation rules and the repair path, see String operations and UTF-8 validation.

  • Java, C#, and Python clients convert string values to UTF-8 on write. Refer to your client library for encoding behavior on read and write.
  • Atomic prepend and append operations can be applied to string values. Prefer the string operations library in Database 8.2.0 and later for Unicode-aware search, slice, case conversion, trim, and regex.
  • Secondary indexes are supported on the string data type for equality queries.

Boolean

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

It is stored as a single byte on the server.

Blob/Bytes

Blobs are byte arrays of a specific size.

  • Any binary data of any type can be stored.
  • An extensive API of bitwise operations can be applied to byte values.