PostgreSQL Professional Advanced Indexing Quiz

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Thames
T
Thames
Community Contributor
Quizzes Created: 11982 | Total Attempts: 187,298
| Attempts: 12 | Questions: 20 | Updated: Aug 15, 2026
Please wait...
Question 1 / 21
🏆 Rank #-- ▾
0 %
0/100
Score 0/100

1. What is the main purpose of an INCLUDE clause in an index definition?

Explanation

An INCLUDE clause adds non-key columns to an index without making them part of its search key. These columns can be returned directly from the index, supporting index-only scans while keeping the key smaller and avoiding the need to sort by the included columns.

Submit
Please wait...
About This Quiz
PostgreSQL Professional Advanced Indexing Quiz - Quiz

Test your knowledge of advanced PostgreSQL indexing strategies and optimization techniques. This quiz covers index types, query planning, performance tuning, and best practices for database professionals. Master the concepts needed to design efficient indexes and improve database performance in production environments.

2.

What first name or nickname would you like us to use?

You may optionally provide this to label your report, leaderboard, or certificate.

2. CONCURRENTLY allows index creation without blocking writes to the table. True or False?

Explanation

Using `CREATE INDEX CONCURRENTLY` allows inserts, updates, and deletes to continue while the index is being built, unlike a standard index creation that blocks writes. The process takes longer and performs additional checks, but it avoids locking out normal write operations during most of the build.

Submit

3. Which parameter controls the cost threshold for index creation decisions?

Explanation

`random_page_cost` sets PostgreSQL’s estimated cost of fetching a page through random access. The query planner uses it when comparing plans, including index scans with sequential scans. Lowering it makes index-based plans more attractive; raising it makes them less attractive. It influences index-use decisions rather than physically creating indexes.

Submit

4. A covering index stores all columns needed by a query to enable index-only scans. True or False?

Explanation

True. A covering index contains every column the query needs, including those used for filtering, joining, or returning results. The database can then satisfy the query directly from the index, avoiding extra table lookups and enabling an index-only scan when the database’s visibility checks allow it.

Submit

5. What does VACUUM ANALYZE do for index maintenance?

Explanation

VACUUM ANALYZE reclaims space by removing dead tuples left behind by updates and deletes, then collects statistics about table data. The planner uses these statistics to choose efficient query execution plans. It does not rebuild or delete indexes or compress their data.

Submit

6. Which index type is optimized for equality comparisons only?

Explanation

Hash indexes use a hash function to map indexed values to locations, making them efficient for exact-match equality comparisons. They do not preserve the ordering of values, so they are not suitable for range queries or sorting, unlike B-tree indexes.

Submit

7. An expression index can index computed values derived from column data. True or False?

Explanation

True. An expression index stores and indexes the result of a calculation or function applied to one or more columns. This can speed up queries that filter or sort using the same expression, such as an index on `LOWER(name)` for case-insensitive searches.

Submit

8. What does FILLFACTOR control in an index definition?

Explanation

FILLFACTOR sets how full index pages are when the index is created or rebuilt. The remaining space is left available for future inserts or updates, which can reduce page splits as the index changes.

Submit

9. Which view shows index usage statistics in PostgreSQL?

Explanation

`pg_stat_user_indexes` reports usage statistics for indexes on user tables, including how often each index has been scanned and how many table or index tuples were read or fetched. By contrast, `pg_indexes` provides index definitions, while `pg_index` and `pg_class` contain catalog metadata rather than usage statistics.

Submit

10. A Hash index supports range queries efficiently. True or False?

Explanation

False. A hash index maps keys to locations using a hash function, which supports efficient equality lookups but does not preserve key order. Range queries require finding and traversing values between bounds, so ordered indexes such as B-trees are generally more suitable.

Submit

11. Which index type in PostgreSQL is best for range queries and supports ORDER BY optimization?

Explanation

B-tree indexes maintain keys in sorted order, making them effective for comparisons and range conditions such as `<`, `>`, and `BETWEEN`. Because entries are ordered, PostgreSQL can also use them to retrieve rows in the requested `ORDER BY` sequence, often avoiding a separate sorting step.

Submit

12. REINDEX rebuilds an index while keeping the table locked. True or False?

Explanation

REINDEX rebuilds an index from the table’s data and, in its standard form, holds a lock that blocks changes to the table during the operation. This can affect concurrent writes until the rebuild finishes.

Submit

13. Which index type uses a Generalized Search Tree structure for geometric data?

Explanation

GiST (Generalized Search Tree) is a flexible index framework that supports different data types and search strategies. It is commonly used for geometric data, enabling efficient spatial queries such as finding objects within a region or near a point.

Submit

14. What does the term 'index bloat' refer to?

Explanation

Index bloat is wasted space within an index that accumulates when rows are deleted or updated. This can make the index larger than necessary and may reduce storage efficiency and query performance.

Submit

15. A composite index on columns (a, b, c) can efficiently support a query filtering on column b only. True or False?

Explanation

A composite index on (a, b, c) is ordered first by a, then by b, then by c. Because a query filtering only on b does not constrain the leading column a, the database generally cannot perform a targeted index seek using that index; it may need a full index scan. An index beginning with b would be more suitable.

Submit

16. Which command removes an index from a PostgreSQL database?

Explanation

`DROP INDEX` removes an index from a PostgreSQL database. The other options are not valid PostgreSQL commands for removing an index.

Submit

17. What is the primary advantage of a BRIN index?

Explanation

BRIN indexes summarize the ranges of values stored in blocks rather than indexing every row. This keeps them very small and makes them effective for large tables where data is physically ordered, especially for range queries. They are not optimal for every query or data layout.

Submit

18. A partial index filters rows using a WHERE clause during index creation. True or False?

Explanation

True. A partial index includes only the rows that satisfy a specified `WHERE` condition, making it smaller and more efficient for queries that target those rows.

Submit

19. Which index type is designed for full-text search operations?

Explanation

GIN (Generalized Inverted Index) is designed to index values containing multiple searchable elements, such as the lexemes produced by PostgreSQL full-text search. It maps each element to the rows containing it, making text queries efficient. Hash indexes support equality, BRIN summarizes page ranges, and partial indexes restrict rows by a predicate.

Submit

20. What does EXPLAIN ANALYZE reveal that EXPLAIN alone does not?

Explanation

EXPLAIN shows the estimated plan for a query, while EXPLAIN ANALYZE runs the query and reports what happened during execution, including actual timings and row counts. This helps compare estimates with real performance and identify bottlenecks.

Submit
×
Saved
Thank you for your feedback!
View My Results
Cancel
  • All
    All (20)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
What is the main purpose of an INCLUDE clause in an index definition?
CONCURRENTLY allows index creation without blocking writes to the...
Which parameter controls the cost threshold for index creation...
A covering index stores all columns needed by a query to enable...
What does VACUUM ANALYZE do for index maintenance?
Which index type is optimized for equality comparisons only?
An expression index can index computed values derived from column...
What does FILLFACTOR control in an index definition?
Which view shows index usage statistics in PostgreSQL?
A Hash index supports range queries efficiently. True or False?
Which index type in PostgreSQL is best for range queries and supports...
REINDEX rebuilds an index while keeping the table locked. True or...
Which index type uses a Generalized Search Tree structure for...
What does the term 'index bloat' refer to?
A composite index on columns (a, b, c) can efficiently support a query...
Which command removes an index from a PostgreSQL database?
What is the primary advantage of a BRIN index?
A partial index filters rows using a WHERE clause during index...
Which index type is designed for full-text search operations?
What does EXPLAIN ANALYZE reveal that EXPLAIN alone does not?
play-Mute sad happy unanswered_answer up-hover down-hover success oval cancel Check box square blue
Alert!