SQLancer
← All Database Flashcards Library / Flashcards / PostgreSQL
🐘 PostgreSQL Knowledge Base

PostgreSQL Study Flashcards

Advanced open-source object-relational database system emphasizing extensibility and standards compliance. Click any card to flip and test your knowledge.

Card 1 of 10 Architecture

What is MVCC in PostgreSQL?

Click Card to Reveal Answer ↷
Answer PostgreSQL

Multi-Version Concurrency Control (MVCC) ensures data consistency by granting each transaction a snapshot of the database, allowing concurrent reads and writes without locking.

Click to Flip Back ↶
Card 2 of 10 Storage

What is the purpose of the Write-Ahead Log (WAL)?

Click Card to Reveal Answer ↷
Answer PostgreSQL

WAL records changes to disk before data pages are updated, ensuring durability and enabling point-in-time recovery (PITR) and replication.

Click to Flip Back ↶
Card 3 of 10 Data Types

How does JSONB differ from standard JSON in Postgres?

Click Card to Reveal Answer ↷
Answer PostgreSQL

JSONB stores data in a parsed binary format that supports indexing (GIN/GiST) and faster processing, whereas JSON stores exact unparsed text.

Click to Flip Back ↶
Card 4 of 10 Performance

What does the EXPLAIN ANALYZE statement do?

Click Card to Reveal Answer ↷
Answer PostgreSQL

EXPLAIN ANALYZE executes the query and provides the exact execution plan along with real execution time and row count statistics.

Click to Flip Back ↶
Card 5 of 10 Maintenance

What is the function of autovacuum?

Click Card to Reveal Answer ↷
Answer PostgreSQL

Autovacuum reclaims dead tuple storage left behind by UPDATEs and DELETEs, and updates planner statistics to maintain performance.

Click to Flip Back ↶
Card 6 of 10 Indexing

What is a GIN Index used for in Postgres?

Click Card to Reveal Answer ↷
Answer PostgreSQL

Generalized Inverted Index (GIN) is designed for composite items like JSONB documents, arrays, and full-text search documents.

Click to Flip Back ↶
Card 7 of 10 DML Syntax

What is the RETURNING clause in INSERT/UPDATE/DELETE?

Click Card to Reveal Answer ↷
Answer PostgreSQL

RETURNING allows DML statements to return modified or inserted row columns directly without issuing a separate SELECT query.

Click to Flip Back ↶
Card 8 of 10 Extensions

What is a Foreign Data Wrapper (FDW)?

Click Card to Reveal Answer ↷
Answer PostgreSQL

FDW allows PostgreSQL to query external datasets (like Remote Postgres, MySQL, Redis, or CSVs) as if they were local tables.

Click to Flip Back ↶
Card 9 of 10 AI & Vector

What is PG Vector used for?

Click Card to Reveal Answer ↷
Answer PostgreSQL

pgvector is an open-source vector similarity search extension for storing and searching high-dimensional AI vector embeddings in Postgres.

Click to Flip Back ↶
Card 10 of 10 Aggregations

How does STRING_AGG work in Postgres?

Click Card to Reveal Answer ↷
Answer PostgreSQL

STRING_AGG concatenates non-null text values from a set of rows into a single string separated by a specified delimiter.

Click to Flip Back ↶

Need practical SQL queries for PostgreSQL?

Explore our ready-to-use copy-paste query recipes in the Cookbook.

View PostgreSQL Cookbook →