Databases: Comparison, Choosing & Polyglot
jsonb: Indexes, Tradeoffs & Exercise
Content
<aside> π§
This page is currently under construction. Please check back later.
</aside>
π Practice exercises are optional and do not need to be submitted.
For all exercises, use a small Spring Boot project with Spring Web, JDBC API, PostgreSQL Driver, Lombok, and Jackson Databind. You may create a fresh project for each exercise, or keep each exercise in its own feature package inside one practice project.
jsonb SchemaChoose a resource that has varying attributes per item type. Good candidates:
Create a markdown file named SCHEMA_DESIGN.md and design a jsonb-backed table for your resource.
Requirements:
jsonb columnjsonb column β each row should have different fields inside the JSONCREATE TABLE SQL statement>> > @> and jsonb_setReflection questions:
jsonb? What was your reasoning?jsonb or become a proper column?jsonb APIChoose one of these resources:
Build a Spring Boot REST API backed by PostgreSQL with a jsonb column.
Requirements:
schema.sql (not manually in psql)DataLoader| Method | Endpoint | What it does |
|---|---|---|
GET |
/api/{resource} |
Get all records |
POST |
/api/{resource} |
Add a new record |
GET |
/api/{resource}?field=value |
Filter by a JSON field using ->> |
GET |
/api/{resource}/search?a=x&b=y |
Filter by multiple JSON fields using @> |
PATCH |
/api/{resource}/{id}/field?value=x |
Update one JSON field using jsonb_set |
JdbcTemplate and RowMapper β same pattern as Week 5404 Not FoundReflection questions:
details->>'field' for a row that does not have that field? Test it and explain the result.@> to match multiple fields. What would break if you tried to do the same thing with >> and WHERE clauses?Set up Backblaze B2 and connect it to a Spring Boot project. Build a minimal file API with three endpoints.
Setup (do this first):
Follow the Backblaze B2 Setup Guide to:
keyID and applicationKey immediately, they are shown only onceapplication.yamlRequirements:
Build these three endpoints:
| Method | Endpoint | What it does |
|---|---|---|
POST |
/api/files/upload |
Upload a file β returns the object key |
GET |
/api/files/link?key=... |
Returns a presigned URL valid for 15 minutes |
DELETE |
/api/files?key=... |
Deletes the file from the bucket |
multipart/form-data request with a field named fileReflection questions:
The HackYourFuture curriculum is licensed underΒ CC BY-NC-SA 4.0 *https://hackyourfuture.net/*

Built with β€οΈ by the HackYourFuture community Β· Thank you, contributors
Found a mistake or have a suggestion? Let us know in the feedback form.