Skip to content

One index, many questions

Different entity types share generic index keys, so one index serves several access patterns.

Why

Here one table holds projects and tasks, and one index, GSI1, serves both. The trick is generic key names: projects write OWNER#ada into gsi1pk, tasks write STATUS#doing into the same attribute.

So one index answers 'Ada's projects' and 'tasks in progress': two access patterns, two entity types, one set of index keys. This overloading is the heart of single-table design.

Generic, overloaded keys let one index do the work of many. That is how a single table serves a whole application.

Try it. Then change it.

Predict what each request will do. Run it, inspect the response, then change a value in the workbench and try again.

  1. On GSI1, project items set gsi1pk to OWNER#ada. So this Query returns Ada's projects.

  2. On the same GSI1, task items set gsi1pk to STATUS#doing instead. The very same index now answers a different question.

Built on this

WorkspaceDynamoDB workbench
Ready to run
Explore an access patternSelect to load & run

On GSI1, project items set gsi1pk to OWNER#ada. So this Query returns Ada's projects.

Request
Execute against the local Dynoxide engine
ReturnedFiltered outChanged
pk(pk)
sk(sk)
name
gsi1pk
gsi1sk
title
PROJECT#web
PROJECT#webS
WebsiteS
OWNER#adaS
PROJECT#webS
—
PROJECT#web
TASK#1S
—
STATUS#doingS
TASK#1S
Hero redesignS
PROJECT#web
TASK#2S
—
STATUS#todoS
TASK#2S
Write copyS
PROJECT#web
TASK#3S
—
STATUS#doneS
TASK#3S
Fix the footerS
PROJECT#api
PROJECT#apiS
APIS
OWNER#adaS
PROJECT#apiS
—
PROJECT#api
TASK#4S
—
STATUS#doingS
TASK#4S
Add paginationS
PROJECT#api
TASK#5S
—
STATUS#todoS
TASK#5S
Rate limitingS
PROJECT#api
TASK#6S
—
STATUS#todoS
TASK#6S
WebhooksS
PROJECT#mobile
PROJECT#mobileS
Mobile appS
OWNER#graceS
PROJECT#mobileS
—
PROJECT#mobile
TASK#7S
—
STATUS#doingS
TASK#7S
Push notificationsS
PROJECT#mobile
TASK#8S
—
STATUS#todoS
TASK#8S
Offline modeS
PROJECT#mobile
TASK#9S
—
STATUS#doneS
TASK#9S
App iconS
PROJECT#data
PROJECT#dataS
Data platformS
OWNER#samS
PROJECT#dataS
—
PROJECT#data
TASK#10S
—
STATUS#doingS
TASK#10S
Nightly exportS
PROJECT#data
TASK#11S
—
STATUS#todoS
TASK#11S
Backfill ordersS
PROJECT#data
TASK#12S
—
STATUS#doneS
TASK#12S
Archive logsS
PROJECT#docs
PROJECT#docsS
Docs siteS
OWNER#adaS
PROJECT#docsS
—
PROJECT#docs
TASK#13S
—
STATUS#todoS
TASK#13S
API referenceS
PROJECT#docs
TASK#14S
—
STATUS#doingS
TASK#14S
QuickstartS
Awaiting request
Your next query starts here.

Choose an access pattern above, or build your own request. See what comes back and what it costs.

Powered by DynoxideWASMStarts on your first run · Runs locally in your browser