Index Basics

Preview — 3 of 10 questions

Which best describes a B-tree index in PostgreSQL?

AA balanced tree data structure that keeps data sorted and allows efficient range queries
BA hash table stored on disk that maps column values to row pointers
CA linked list of all table rows sorted by the indexed column
DA copy of the table stored in a separate file

What index is automatically created when you define a PRIMARY KEY constraint?

AA B-tree UNIQUE index on the primary key column(s)
BA UNIQUE index on the primary key column(s)
CNo index — PRIMARY KEY is just a constraint
DA hash index on the primary key column(s)

Which statement correctly creates a unique index on the email column of the users table?

ACREATE INDEX ON users (email);
BCREATE UNIQUE INDEX idx_users_email ON users (email);
CALTER TABLE users ADD UNIQUE (email);
DBoth B and C create a unique constraint/index

Sign up free to play

Answer all 10 questions (7 more), see explanations for every answer, and track your score.