POSTGRESQL-ESSENTIALS practice question 6 of 15

You want to set the maximum time to complete client authentication to 10 seconds. Which parameter should you configure?

Full set: 71 questions
Answer options
A: authentication_timeout = 10s Correct answer
B: auth_timeout = 10s
C: client_timeout = 10s
D: connection_timeout = 10s
Correct Answer:
A. authentication_timeout = 10s
Explanation

The authenticationtimeout parameter is the specific server setting in PostgreSQL used to control the maximum time allowed for a client to complete the authentication process. The value is specified in seconds. Setting authenticationtimeout = 10s in the postgresql.conf file ensures that if a client does not successfully authenticate within 10 seconds of connecting, the server will close the connection. This prevents connections from lingering indefinitely in the authentication phase, which is a crucial security and resource management measure.

Why Incorrect

B. authtimeout is not a valid or recognized server configuration parameter in PostgreSQL.
C. clienttimeout is a deprecated alias for statementtimeout, which governs the maximum duration for any single SQL statement, not the authentication process.
D. connectiontimeout is a client-side connection string parameter used to set a timeout for establishing the initial network connection, not a server-side authentication setting.

References

1. PostgreSQL 16 Documentation, Chapter 20. Server Configuration, Section 20.4. Connection and Authentication:

Parameter: authenticationtimeout (integer)

Description: "Maximum time to complete client authentication, in seconds. If a client has not completed the authentication protocol in this much time, the server closes the connection. This prevents stuck clients from occupying a connection indefinitely. The default is one minute (1m)."

Source: PostgreSQL Documentation: Connection Settings

2. PostgreSQL 16 Documentation, Chapter 20. Server Configuration, Section 20.11. Client Connection Defaults:

Parameter: statementtimeout (integer)

Description: "Abort any statement that takes more than the specified amount of time... A value of zero (the default) turns this off. The clienttimeout setting is a deprecated alias for this." (This confirms option C is incorrect).

Source: PostgreSQL Documentation: Client Connection Defaults

3. PostgreSQL 16 Documentation, Chapter 34. libpq - C Library, Section 34.2. Database Connection Control Functions:

Parameter: connecttimeout

Description: "Maximum time to wait for connection, in seconds (write as a decimal integer string). Zero, negative, or not specified means wait indefinitely. The minimum timeout is 2 seconds. This timeout applies to each host name or IP address individually." (This confirms connectiontimeout is a client-side concept, referenced here as connecttimeout in libpq).

Source: PostgreSQL Documentation: libpq Connection Strings

Scroll to Top