PartiQL & SQL
You paste SQL habits into PartiQL, run SELECT * FROM tickets WHERE status = 'OPEN',
and DynamoDB maps it to a table Scan that bills every item. PartiQL borrows SQL
syntax; it does not borrow a relational planner.
PartiQL runs SELECT, INSERT, UPDATE and DELETE against one table per
statement. There is no JOIN, no GROUP BY, and no aggregate function at all.
For those you have native options: pre-computed aggregate items, an export to S3
queried with Athena, or the Athena DynamoDB connector. DynoTable's SQL Workbench
runs them on your desktop: it scans the FROM table and reads a keyed JOIN's other
side by key.
What this section teaches you to do
- Predict whether a PartiQL statement becomes a
Queryor a full-tableScan. - Know that DynamoDB applies PartiQL DML immediately, and stage it in DynoTable when you want a diff first.
- Get
JOIN,GROUP BYand aggregate answers natively or in the Workbench. - Explain to teammates why "SQL on DynamoDB" still reads by key or by scan, and what each one costs.
Reading order
- SQL for DynamoDB: what SQL you get on DynamoDB, and
where to run
JOINandGROUP BY: Athena, Redshift, Hive on EMR, the Workbench. - PartiQL vs SQL: the syntax overlap, the engine limits, and what breaks.
- PartiQL examples:
SELECT/INSERT/UPDATE/DELETEpatterns that map cleanly to DynamoDB APIs. - JOIN: denormalize, single-table design, app-side joins
with
BatchGetItem, and SQL engines for the ad-hoc join. - GROUP BY: atomic counters, Streams + Lambda rollups, export to S3 + Athena, and app-side grouping.
- COUNT, SUM, aggregates: what
Select=COUNTcosts, whyItemCountis stale, and whereSUM/AVGcome from.
SELECT count(*) FROM events doesn't run at all: PartiQL rejects it with
ValidationException: Unexpected path component at 1:8:5. The native count is
Select=COUNT on a Scan or Query, which still bills every item it evaluates.
A Workbench JOIN reads the FROM table, then looks up each match on the joined
table by key. Narrow the FROM read with a key condition first; the Workbench joins
and groups only what it fetched.
Try it in DynoTable
Download DynoTable. The SQL Workbench editor is available on free read-only plans with autocomplete powered by a local inferred schema. Paid plans add running Workbench queries and exports.
PartiQL SELECT is free to run. PartiQL DML (INSERT, UPDATE, DELETE) stages
like any other edit: Commit changes writes it in one step, Stage changes
leaves a reviewable diff, and either way the write is journaled.
The cost status bar on Workbench and PartiQL tabs shows ~N items · ~R RCU when the
plan is known, so a statement that becomes a Scan shows before you run it. For a
JOIN it covers the FROM read; joined lookups are flagged, not priced.
A Workbench Execute reads one page; Run to end reads every page, with no item
cap. On 500k items of ~2 KB, a keyless full read is about 125,000 read request units
($0.016 at us-east-1 list price); a keyed Query takes a handful.
The PartiQL examples work through that cost, and the pricing calculator prices your own table.
Read the SQL Workbench docs for JOIN and aggregate limits, and use the query builder for the same access pattern without hand-written API JSON.