Working with data and history in Amazon QLDB - Amazon Quantum Ledger Database (Amazon QLDB)

Working with data and history in Amazon QLDB

Important

End of support notice: Existing customers will be able to use Amazon QLDB until end of support on 07/31/2025. For more details, see Migrate an Amazon QLDB Ledger to Amazon Aurora PostgreSQL.

The following topics provide basic examples of create, read, update, and delete (CRUD) statements. You can manually run these statements by using the PartiQL editor on the QLDB console, or the QLDB shell. This guide also walks you through the process of how QLDB handles your data as you make changes in your ledger.

QLDB supports the PartiQL query language.

For code examples that show how to programmatically run similar statements using the QLDB driver, see the tutorials in Getting started with the driver.

Tip

The following is a short summary of tips and best practices for working with PartiQL in QLDB:

  • Understand concurrency and transaction limits – All statements, including SELECT queries, are subject to optimistic concurrency control (OCC) conflicts and transaction limits, including a 30-second transaction timeout.

  • Use indexes – Use high-cardinality indexes and run targeted queries to optimize your statements and avoid full table scans. To learn more, see Optimizing query performance.

  • Use equality predicates – Indexed lookups require an equality operator (= or IN). Inequality operators (<, >, LIKE, BETWEEN) don't qualify for indexed lookups and result in full table scans.

  • Use inner joins only – QLDB supports inner joins only. As a best practice, join on fields that are indexed for each table that you're joining. Choose high-cardinality indexes for both the join criteria and the equality predicates.