Recall & Review
beginner
What is the main difference between JSON and JSONB data types in PostgreSQL?
JSON stores data as plain text, while JSONB stores data in a binary format that is faster to process and query.
Click to reveal answer
beginner
Which data type, JSON or JSONB, supports indexing for faster queries in PostgreSQL?
JSONB supports indexing, which makes queries faster. JSON does not support indexing.
Click to reveal answer
intermediate
Does JSONB preserve the order of object keys in PostgreSQL?
No, JSONB does not preserve the order of object keys. JSON preserves the exact text including order.
Click to reveal answer
intermediate
Which data type is generally faster to insert: JSON or JSONB?
JSON is faster to insert because it stores data as plain text without extra processing. JSONB requires parsing and converting to binary format.
Click to reveal answer
advanced
Can JSONB store duplicate keys in objects like JSON can?
No, JSONB does not allow duplicate keys in objects. JSON can store duplicate keys as it stores raw text.
Click to reveal answer
Which PostgreSQL data type stores JSON data in a binary format?
✗ Incorrect
JSONB stores JSON data in a binary format for faster processing.
Which data type preserves the exact text and order of keys in JSON objects?
✗ Incorrect
JSON preserves the exact text including whitespace and key order.
Which data type allows indexing to speed up queries?
✗ Incorrect
JSONB supports indexing, JSON does not.
Which data type is faster to insert when you don't need to query the data often?
✗ Incorrect
JSON is faster to insert because it stores raw text without extra processing.
Can JSONB store duplicate keys in the same JSON object?
✗ Incorrect
JSONB does not allow duplicate keys; it enforces unique keys.
Explain the key differences between JSON and JSONB in PostgreSQL.
Think about storage format, performance, and indexing.
You got /7 concepts.
When would you choose JSON over JSONB in PostgreSQL and why?
Consider use cases focused on data storage vs querying.
You got /3 concepts.