Sample Exam Questions
※This sample exam is different from those that appear in the actual OSS-DB Exam.
2024/05/01
current_timestamp (it is a "function" but used without parentheses) returns the current time in microseconds. However, within a transaction, it returns the start time of the transaction, meaning it always returns the same value within the same transaction. Since it is in microseconds, even if you execute it quickly in succession, it will not return the same value. Also, even within the same session, if the transactions are different, it will return different values. In option D, by executing the BEGIN command just before the two subsequent SELECT statements, they are executed within the same transaction.
Therefore, the correct answer is D.
In the PostgreSQL extension, there is a function called transaction_timestamp(), which, as the name suggests, returns the start time of the transaction. However, current_timestamp also has the same meaning.
Also, as part of the PostgreSQL extension, for cases where you want to get the time when each SQL was actually executed within a transaction, functions like statement_timestamp() and clock_timestamp() are available. They return the time when the SQL statement was executed and the time when the function was actually executed within the SQL, respectively.
© EDUCO All Rights Reserved.