Buckets

SQL - CREATE BUCKET

Creates a new bucket in the database. Once created, you can use the bucket to save records by specifying its name during saves. If you want to add the new bucket to a type, follow its creation with the ALTER TYPE command.

Syntax

CREATE BUCKET <bucket> [ID <bucket-id>]
  • <bucket> Defines the name of the bucket you want to create. You must use a letter for the first character, for all other characters, you can use alphanumeric characters, underscores and dashes.

  • <bucket-id> Defines the numeric ID you want to use for the bucket.

Examples

  • Create the bucket account:

ArcadeDB> CREATE BUCKET account

For more information see:

SQL - DROP BUCKET

Removes the bucket and all of its content. This operation is permanent and cannot be rolled back.

Syntax

DROP BUCKET <bucket-name>|<bucket-id>
  • <bucket-name> Defines the name of the bucket you want to remove.

  • <bucket-id> Defines the ID of the bucket you want to remove.

Examples

  • Remove the bucket Account:

ArcadeDB> DROP BUCKET Account

For more information, see:

SQL - TRUNCATE BUCKET

Deletes all records of a bucket. This command operates at a lower level than the standard DELETE command.

Truncation is not permitted on vertex or edge types, but you can force its execution using the UNSAFE keyword. Forcing truncation is strongly discouraged, as it can leave the graph in an inconsistent state.

Syntax

TRUNCATE BUCKET <bucket>
  • <bucket> Defines the bucket to delete.

  • UNSAFE Defines whether the command forces the truncation on vertex or edge types.

Transactions

As with TRUNCATE TYPE, the command is part of the caller’s transaction when one is active - a ROLLBACK puts every record back - and owns a transaction of its own, committing one batch of arcadedb.truncateBatchSize records at a time, when none is. The result set reports which applied through the transactional field.

Before v26.9.1 the command always committed as it went, even inside a transaction, so a ROLLBACK after a TRUNCATE BUCKET recovered at most the records of the last uncommitted batch.

Examples

  • Remove all records in the bucket profile:

ArcadeDB> TRUNCATE BUCKET profile

For more information, see: