What is the difference between NOW() and CURRENT_TIMESTAMP in PostgreSQL?
Answer
In PostgreSQL, NOW() and CURRENT_TIMESTAMP are effectively equivalent — both return the current date and time with timezone at the start of the current transaction. This means they return the same value throughout a transaction, even if the transaction takes minutes. This is important for consistency: all rows inserted in one transaction get the same timestamp. CLOCK_TIMESTAMP() returns the actual current wall-clock time at the moment it is called, changing throughout the transaction — use it when you need the true elapsed time. STATEMENT_TIMESTAMP() returns the time at the start of the current statement. TIMEOFDAY() returns wall-clock time as text.
Previous
What are common date/time functions in PostgreSQL?
Next
How do you use CASE expressions in PostgreSQL?