Reputation: 326
I have a query that does something like this --
SELECT localtimestamp, x, y, z
FROM table1
WHERE updated_at > NOW() - INTERVAL '1 minute';
updated_at
is defined to be set to the current_timestamp
by default (in this case, I've verified that localtimestamp
and current_timestamp
are the same on the DB server).
Is it possible for this query to return records where updated_at > localtimestamp
(the first field returned by the query)? In other words, can records be inserted into the table while the query is executing?
There are no explicit locks being acquired or transactions in the picture.
Upvotes: 1
Views: 59
Reputation: 21336
Other inserts are allowed to happen, but your query won't see them.
From the documentation on isolation levels:
A statement can only see rows committed before it began. This is the default.
Upvotes: 2