




























































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





























































































Question 1. Which PostgreSQL process is responsible for listening on the TCP/IP port and spawning new backend processes for client connections? A) autovacuum launcher B) postmaster (also called the server) C) walwriter D) checkpoint process Answer: B Explanation: The postmaster (now called the PostgreSQL server) accepts incoming connections and creates a new backend process for each client. Question 2. In PostgreSQL 11, where are tablespace locations stored on the file system? A) Inside the data directory under pg_tblspc as symbolic links B) Directly within the base directory of the cluster C) In the pg_default tablespace only D) In the pg_wal directory Answer: A Explanation: Each tablespace is represented by a symbolic link in $PGDATA/pg_tblspc that points to the actual directory on disk. Question 3. What is the primary purpose of Multi-Version Concurrency Control (MVCC) in PostgreSQL? A) To lock entire tables during updates
B) To allow readers to see a consistent snapshot without blocking writers C) To enforce row‑level security policies D) To compress data automatically Answer: B Explanation: MVCC stores multiple row versions, enabling concurrent reads and writes without blocking each other. Question 4. Which component of the Write‑Ahead Log (WAL) is written before the corresponding data pages are flushed to disk? A) Checkpoint record B) Full page image (FPI) C) Transaction commit record D) Archive command Answer: C Explanation: WAL records, including transaction commit entries, are written first to guarantee durability before data pages are flushed. Question 5. Which configuration file controls client authentication methods such as md5, scram‑sha‑256, and peer? A) postgresql.conf B) pg_hba.conf C) pg_ident.conf D) pg_service.conf
Question 8. Which GRANT syntax correctly gives a role SELECT permission on a specific column of a table? A) GRANT SELECT(column_name) ON table_name TO role_name; B) GRANT SELECT ON table_name(column_name) TO role_name; C) GRANT SELECT (column_name) ON table_name TO role_name; D) GRANT SELECT(column_name) FROM table_name TO role_name; Answer: A Explanation: SELECT(column_name) specifies column‑level privileges. Question 9. In pg_hba.conf, which authentication method provides password‑based authentication using the SCRAM‑SHA‑256 algorithm? A) md B) password C) scram-sha- 256 D) trust Answer: C Explanation: scram-sha-256 is the modern, salted password authentication method. Question 10. Which setting must be enabled to force SSL connections for all clients? A) ssl = on in postgresql.conf
B) require_ssl = true in pg_hba.conf C) sslmode = require in client connection string D) ssl_enforce = true in postgresql.conf Answer: A Explanation: Setting ssl = on enables SSL; clients must then request SSL, and you can enforce it via pg_hba.conf entries. Question 11. Which extension provides cryptographic functions such as encrypt and decrypt for column‑level data protection? A) pgcrypto B) pgpcrypto C) cryptopg D) pg_encryption Answer: A Explanation: The pgcrypto extension implements encryption, decryption, and hashing functions. Question 12. Which pg_dump option includes both schema and data for all databases in a cluster? A) – schema-only B) – data-only C) – all D) – create
Question 15. In a Point‑In‑Time Recovery (PITR), which recovery.conf (or postgresql.auto.conf) parameter specifies the exact timestamp to stop recovery? A) recovery_target_time B) recovery_target_xid C) restore_point_name D) recovery_target_name Answer: A Explanation: recovery_target_time tells PostgreSQL to stop replaying WAL at the given timestamp. Question 16. Which of the following is NOT a valid value for the recovery_target_action parameter? A) pause B) promote C) shutdown D) resume Answer: D Explanation: Valid actions are pause, promote, and shutdown. “resume” is not recognized. Question 17. Which PostgreSQL command updates the optimizer statistics for a specific table? A) VACUUM ANALYZE table_name;
B) REINDEX TABLE table_name; C) ANALYZE table_name; D) CLUSTER table_name; Answer: C Explanation: ANALYZE collects column statistics used by the planner. Question 18. In an EXPLAIN output, which node type indicates that the planner expects to read the entire table sequentially? A) Index Scan B) Bitmap Heap Scan C) Seq Scan D) Tid Scan Answer: C Explanation: “Seq Scan” means a sequential scan of all rows. Question 19. Which index type is most suitable for full‑text search on an array of tsvector values? A) B‑tree B) GIN C) GiST D) BRIN Answer: B
Question 22. Which tablespace attribute can improve I/O performance for large, append‑only tables? A) USING BRIN index B) SET storage_parameters (autovacuum_enabled = false) C) Placing the tablespace on a high‑throughput SSD D) Enabling wal_compression Answer: C Explanation: Locating the tablespace on fast storage reduces I/O latency for heavy writes. Question 23. Which of the following is a best practice for writing efficient subqueries? A) Use SELECT * inside the subquery B) Correlate the subquery whenever possible C) Replace NOT IN with NOT EXISTS when dealing with NULLs D) Avoid using CTEs because they always materialize the result Answer: C Explanation: NOT EXISTS correctly handles NULL values and often yields better plans than NOT IN. Question 24. Which parameter controls the maximum number of parallel workers that a single query can launch? A) max_parallel_workers_per_gather
B) max_worker_processes C) max_parallel_workers D) parallel_leader_participation Answer: A Explanation: max_parallel_workers_per_gather limits workers per parallel query. Question 25. Which replication mode guarantees that a transaction is not considered committed on the primary until at least one standby has written the WAL record to disk? A) Asynchronous replication B) Synchronous replication C) Logical replication D) Cascading replication Answer: B Explanation: Synchronous replication waits for the standby to acknowledge receipt of the WAL. Question 26. In streaming replication, which parameter on the primary determines the maximum amount of WAL that can be retained for standby servers? A) wal_keep_segments B) max_wal_size C) wal_sender_timeout
Question 29. Which connection pooler works at the protocol level and can pool both transaction and session connections? A) PgBouncer in transaction pooling mode B) PgBouncer in session pooling mode C) Pgpool‑II in load‑balancing mode D) Both A and C can pool at both levels Answer: D Explanation: PgBouncer supports transaction and session pooling; Pgpool‑II can also pool at the session level and provide load balancing. Question 30. What is the primary risk associated with transaction ID (XID) wraparound? A) Data loss due to missing WAL segments B) Permanent table locks C) Inability to see rows inserted after wraparound, leading to data corruption D) Automatic shutdown of the server Answer: C Explanation: When XIDs wrap around, visibility checks can become incorrect, potentially corrupting data. Question 31. Which command performs a full‑table rewrite and reclaims space, but requires an exclusive lock on the table?
A) VACUUM FULL table_name; B) VACUUM (FULL, ANALYZE) table_name; C) CLUSTER table_name USING index_name; D) REINDEX TABLE table_name; Answer: A Explanation: VACUUM FULL rewrites the whole table and needs an exclusive lock. Question 32. Which autovacuum parameter controls how many dead tuples must exist before a vacuum is triggered on a table? A) autovacuum_vacuum_scale_factor B) autovacuum_vacuum_threshold C) autovacuum_analyze_scale_factor D) autovacuum_naptime Answer: B Explanation: autovacuum_vacuum_threshold is the base number of dead tuples required. Question 33. Which command updates statistics for all tables in the current database? A) VACUUM; B) ANALYZE; C) REINDEX;
Question 36. When a deadlock is detected, what does PostgreSQL do? A) Terminates the entire transaction block B) Rolls back the whole database C) Cancels one of the involved transactions with an error code 40P D) Automatically retries the conflicting statements Answer: C Explanation: PostgreSQL aborts one transaction (the “victim”) and returns a deadlock detected error. Question 37. Which extension provides a view that aggregates query execution statistics per normalized query? A) pg_stat_statements B) pg_stat_user_functions C) pg_buffercache D) pg_freespace Answer: A Explanation: pg_stat_statements tracks execution counts, total time, and other metrics for each distinct query. Question 38. Which declarative partitioning method in PostgreSQL 11 distributes rows based on a hash of a column value? A) RANGE PARTITION
Answer: C Explanation: HASH PARTITION creates partitions based on the hash of the partition key. Question 39. Which command creates a foreign table that accesses a remote PostgreSQL server using the postgres_fdw extension? A) CREATE SERVER remote_pg FOREIGN DATA WRAPPER postgres_fdw OPTIONS (host 'host', dbname 'db'); B) CREATE FOREIGN TABLE … SERVER remote_pg; C) Both A and B are required steps D) CREATE EXTENSION postgres_fdw; Answer: C Explanation: First you create the server (A), then the foreign table (B). The extension must also be installed (D), but the question asks for the command that creates the foreign table, which includes both steps. Question 40. Which extension allows you to generate universally unique identifiers (UUIDs) inside PostgreSQL? A) pgcrypto B) uuid-ossp
Explanation: PostgreSQL does not have built‑in scheduling; external tools (cron, pgAgent) must be used. Question 43. Which system view lists the current locks held by each backend? A) pg_locks B) pg_lock_status C) pg_stat_activity D) pg_stat_lock Answer: A Explanation: pg_locks shows lock type, mode, and owning process. Question 44. Which parameter controls the amount of memory used for sorting operations and hash tables in a single query? A) shared_buffers B) work_mem C) maintenance_work_mem D) temp_buffers Answer: B Explanation: work_mem is allocated per operation (sort, hash) within a query. Question 45. If you set effective_cache_size to 24 GB on a server with 32 GB RAM, what does PostgreSQL assume?
A) That 24 GB of RAM is dedicated to shared_buffers B) That the OS will provide 24 GB of cache for PostgreSQL data C) That the total WAL size is limited to 24 GB D) That autovacuum will use 24 GB of memory Answer: B Explanation: effective_cache_size is an estimate of the amount of memory available for caching data files. Question 46. Which of the following is a characteristic of a BRIN index? A) Stores a separate entry for every row B) Efficient for very large tables with naturally ordered data C) Requires frequent reindexing D) Supports full‑text search out of the box Answer: B Explanation: BRIN indexes store summary ranges and work best when data is ordered. Question 47. Which GUC (Grand Unified Configuration) parameter enables compression of WAL records before they are archived? A) wal_compress B) wal_compression C) archive_compression