Skip to content
Webinar - April 23: Breaking the trade-off: ACID transactions at scaleRegister now

Record metadata

Aerospike record metadata expressions allow you to access and evaluate record-level metadata in queries.

This guide covers expressions like record_size, key_exists, ttl, last_update, and since_update, which return details such as record size, existence, and update times. Code examples show how to use these expressions for efficient filtering and data retrieval.

Ops

device_size
device_size()
Description

Returns the record’s storage size in bytes as an integer. Value is 0 when namespace is configured storage-engine memory.

Note: deprecated as of Aerospike Database 7.0.

Returns
integer_value
Introduced
5.2.0.4
Example

Find records that occupy more than 1 MiB of storage space.

as_exp_build(predexp,
as_exp_gt(as_exp_device_size(), as_exp_int(1024 * 1024)));
digest_modulo
digest_modulo(mod)
Description

Returns a record digest modulo as an integer.

Arguments
NameType
mod integer_value
Returns
integer_value
Introduced
5.2.0.4
Example

Sample records where digest mod 3 equals 0

as_exp_build(predexp,
as_exp_cmp_eq(as_exp_digest_modulo(3), as_exp_int(0)));
is_tombstone
is_tombstone()
Description

Returns true if the record is a tombstone, otherwise it returns false.
Note: Only applies to XDR filters and when used in a write request with a read/write expressions.

Returns
boolean_value
Introduced
5.2.0.4
Example

Create an XDR filter to only ship tombstones.

as_exp_build(predexp, as_exp_is_tombstone());
key_exists
key_exists()
Description

“Returns true if the record has a stored key, otherwise it returns false.”

Returns
boolean_value
Introduced
5.2.0.4
Example

Return all records that have a stored key.

as_exp_build(predexp, as_exp_key_exists());
last_update
last_update()
Description

Returns the record’s last-update-time (LUT) in nanoseconds (millisecond resolution) from Unix Epoch (1/1/1970) as an integer.

Returns
integer_value
Introduced
5.2.0.4
Example

Return all records where the last-update-time is less than bin ‘updateBy’.

as_exp_build(predexp,
as_exp_cmp_lt(
as_exp_last_update(), as_exp_bin_int("updateby")));;
memory_size
memory_size()
Description

Starting with Database 7.0: Returns the record’s size in bytes as an integer when the namespace is configured storage-engine memory , otherwise returns 0.

Prior to Database 7.0: Returns the record’s memory size in bytes as an integer when either the namespace is configured data-in-memory true or storage-engine memory , otherwise returns 0.

Note: deprecated as of Database 7.0. Use record_size instead.

Returns
integer_value
Introduced
5.3.0
Example

Find records that occupy more than 1 MiB of memory.

as_exp_build(predexp,
as_exp_gt(as_exp_memory_size(), as_exp_int(1024 * 1024)));
record_size
record_size()
Description

Returns the record’s size in bytes as an integer.

Returns
integer_value
Introduced
7.0
Example

Find records that occupy more than 1 MiB of memory.

as_exp_build(predexp,
as_exp_gt(as_exp_record_size(), as_exp_int(1024 * 1024)));
set_name
set_name()
Description

Returns the record’s set_name as a string.

Returns
string_value
Introduced
5.2.0.4
Example

Return all records where the set_name is either ‘groupA’ or ‘groupB’.

as_exp_build(predexp, as_exp_or(
as_exp_cmp_eq(as_exp_set_name(), as_exp_str("groupA")),
as_exp_cmp_eq(as_exp_set_name(), as_exp_str("groupB"))));
since_update
since_update()
Description

Returns the time (in milliseconds) since the record was last updated.

Returns
integer_value
Introduced
5.2.0.4
Example

Return records that were updated within the last 2 hours.

as_exp_build(predexp,
as_exp_cmp_lt(
as_exp_since_update(), as_exp_int(2 * 60 * 60 * 1000)));;
ttl
ttl()
Description

Returns the record’s TTL (Time To Live) as an integer.

Returns
integer_value
Introduced
5.2.0.4
Example

Return all records that will expire within 24 hours.

as_exp_build(predexp,
as_exp_cmp_le(as_exp_ttl(), as_exp_int(24 * 60 * 60)));
void_time
void_time()
Description

Returns the record’s expiration time in nanoseconds (resolution in seconds) as an integer.

Returns
integer_value
Introduced
5.2.0.4
Example

Return all records where the void-time is set to ‘never expire’.

as_exp_build(predexp,
as_exp_cmp_eq(as_exp_void_time(), as_exp_int(-1)))
Feedback

Was this page helpful?

What type of feedback are you giving?

What would you like us to know?

+Capture screenshot

Can we reach out to you?