0
0
PostgreSQLquery~5 mins

JSON vs JSONB differences in PostgreSQL - Quick Revision & Key Differences

Choose your learning style9 modes available
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?
ATEXT
BJSONB
CJSON
DXML
Which data type preserves the exact text and order of keys in JSON objects?
AJSON
BJSONB
CXML
DARRAY
Which data type allows indexing to speed up queries?
AJSON
BVARCHAR
CTEXT
DJSONB
Which data type is faster to insert when you don't need to query the data often?
AINTEGER
BJSONB
CJSON
DBOOLEAN
Can JSONB store duplicate keys in the same JSON object?
ANo
BYes
COnly if keys are numeric
DOnly if keys are strings
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.