Reputation: 123
This question is a little spin-off from Refactor functions so they can be used within a CTE.
The question is simple: is there a different in executing a SELECT
query in a READ COMMITTED
versus a REPEATABLE READ
transaction? We assume that no other queries (even 'SELECT' queries) are done in the transaction. So the transaction is only executing one single SELECT
query.
Upvotes: 1
Views: 179
Reputation: 248215
Normally there won't be a difference for a single SELECT
statement.
The exception is if the SELECT
statement calls user defined functions that themselves issue multiple SQL statements.
In this case, REPEATABLE READ
will make all these SQL statements share a single snapshot of the database, while READ COMMITTED
will cause each SQL statement to see a different state of the database.
Upvotes: 3