Can you insert a record without a PK (primary key)?

primarykey

#1

Hi All,

I am planning to use Aerospike as DB for very large volume of data. The records will not have any primary key. Its kind of statistics where i don’t need any primary key. Is it possible to insert records without primary key.

Regards, Aditya


#3

@Aditya,

The short answer is - you need a primary key in order to insert records. Aerospike is a key-value store … :heart_eyes:

A record is composed of the following:

  • A key/digest: each record will have a key associated to it.
  • Metadata: the metadata provides information about the version of the record (generation) and the time-to-live (TTL).
  • Bins: they are the equivalent of columns or fields in a conventional RDBMS.

The key is what the application will use to read or write the record. However, when the key is sent to the database, the key is hashed into a 160-bit digest. Within the database, the digest is used to address the record for all operations. The key may be an integer, string or bytes value.

So you can’t insert a record without a primary key. You will find information on the command for inserting a record here.


#4

@Mnemaudsyne

Thanks a lot for clearing up my understandings…