Is it possible to get all primary keys from a set excluding scanning?

I have a big set with over 1 billion keys, the value type of the keys is cdt-map, which I worry scanning the set might cause heavy IO pressure to the cluster. And I just need the keys to analyse, not content.

The write policy of this set has enable KEY_SEND, so there will be PKs in the records. I’ve tried some ways like using AQL tool to excute commands like “select PK from ns.set”, but this command doesn’t work. So is there any other way I could gain the all PKs from a set?

P.S. There are some problems with the AQL tool, when I try to execute command on the big set, the command executed failed due to socket timeout, and then I user --socket-timeout=1000000 to specify the socket timeout param, the AQL tool throws a ‘Segmentation fault’ error. Here is the error info:

AQL tool version info:
Version 3.20.0 C Client Version 4.6.3

The keys are not kept in memory (unless data-in-memory). Retrieving the keys will add pressure to whichever storage layer you have configured. When scanning, you can reduce the network load by setting the includeBinData flag to false.

Ok, I’ll try then.

Hi, I’ve tried and found that there is no such setting in C client sdk.
The scan function in C client takes a struct named “as_policy_scan” as input policy, but there is no such flag to set.

source code:

typedef struct as_policy_scan_s {

  /**  
   *  Maximum time in milliseconds to wait for the operation to complete.
   *  The default (0) means do not apply a total timeout.
   */
  uint32_t timeout;

  /**  
   *  Maximum socket idle time in milliseconds when processing a database command.
   *  Zero means do not apply a socket idle timeout.
   *
   *  This scan socket timeout is also applied on server side as well.
   *
   *  Default: 10000 ms
   */
  uint32_t socket_timeout;

  /**  
   *  Abort the scan if the cluster is not in a stable state.
   */
  bool fail_on_cluster_change;

  /**  
   *  If the scan runs a UDF which results in a record deletion, leave a tombstone for the record.
   *  This prevents deleted records from reappearing after node failures.
   *  Valid for Aerospike Server Enterprise Edition only.
   *
   *  Default: false (do not tombstone deleted records).
   */
  bool durable_delete;

} as_policy_scan;

The C client library supports this feature is a slightly different way:

https://www.aerospike.com/apidocs/c/d1/dc3/structas__scan.html#ae8cd196a8ee3c0f2c48c1b0761bb34a9