What is the difference in executing a single select query in read committed versus repeatable read transaction?

扶醉桌前 提交于 2019-12-11 09:45:24

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/48152797/what-is-the-difference-in-executing-a-single-select-query-in-read-committed-vers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!