> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kinetica.com/llms.txt
> Use this file to discover all available pages before exploring further.

# record_retriever

> record_retriever — Kinetica Rust API

[gpudb\_api](https://docs.kinetica.com/content/api/rust/index.md)
[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/record_retriever.rs#L1-L1949)&#x20;

Record retriever for efficient record retrieval from Kinetica with multi-head support.This module provides the [`RecordRetriever`](https://docs.kinetica.com/content/api/rust/record_retriever/struct.RecordRetriever) struct which allows efficient retrieval of records from GPUdb, with support for multi-head access. `RecordRetriever` instances are thread safe and may be used from any number of tasks simultaneously.A retriever is given the [`Type`](https://docs.kinetica.com/content/api/rust/generic_record/struct.Type) of the table’s records, takes typed key values ([`ShardKeyValue`](https://docs.kinetica.com/content/api/rust/bulk_inserter_common/enum.ShardKeyValue), with [`ShardKeyValue::Null`](https://docs.kinetica.com/content/api/rust/bulk_inserter_common/enum.ShardKeyValue#variant.Null) for a null), and returns the records decoded: as [`GenericRecord`](https://docs.kinetica.com/content/api/rust/generic_record/struct.GenericRecord)s, or as any type serde can deserialize from the type’s Avro schema.

## Example

```rust theme={null}
use gpudb_api::{Kinetica, KineticaOptions, RecordRetriever, ShardKeyValue, Type};
use std::sync::Arc;

let options = KineticaOptions::new();
let kinetica = Arc::new(
    Kinetica::new(vec!["http://localhost:9191".to_string()], options).await?
);
let record_type = Arc::new(Type::from_table(&kinetica, "my_table").await?);

// Create retriever with default options
let retriever = RecordRetriever::new(kinetica.clone(), "my_table", record_type).await?;

// Retrieve all records
let response = retriever.get_by_key(&[], None).await?;

// Retrieve records by key
let response = retriever.get_by_key(&[ShardKeyValue::Int(123)], None).await?;
for record in &response.data {
    println!("{:?}", record.get(0));
}

// Retrieve with expression filter
let response = retriever.get_by_key(&[], Some("status = 'active'")).await?;
```

## Structs

[Record<wbr />Retriever](https://docs.kinetica.com/content/api/rust/record_retriever/struct.RecordRetriever.md)Object that permits efficient retrieval of records from GPUdb, with support for multi-head access.[Record<wbr />Retriever<wbr />Options](https://docs.kinetica.com/content/api/rust/record_retriever/struct.RecordRetrieverOptions.md)Options for the RecordRetriever.

## Constants

`pub const END_OF_SET: i64 = -9999;`

End of set marker for retrieving all records

## Traits

[Retrieved<wbr />Record](https://docs.kinetica.com/content/api/rust/record_retriever/trait.RetrievedRecord.md)A record a [`RecordRetriever`](https://docs.kinetica.com/content/api/rust/record_retriever/struct.RecordRetriever) returns, decoded from the Avro binary form the server sends by the [`Type`](https://docs.kinetica.com/content/api/rust/generic_record/struct.Type) the retriever was given.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.