Hi Christian Beikov , Sorry for late reply. I think that adding some config that would control this behavior is way to go, and by default it would not be applicable. I see that there are following options:
- Introduce 2 options, one to apply the limit to subquery, another to check for correspondence of data. With this setup one who uses SNAPSHOT or SERIALIZABLE transaction isolation levels can go with true and false, and the one who uses READ_COMMITED can go with true and true options.
| |
SUBQUERY_APPLY_LIMIT |
SUBQUERY_CHECK_CORRESPONDENCE |
| SNAPSHOT or SERIALIZABLE |
true |
false |
| READ_COMMITED |
true |
true |
With this parametrization we would avoid additional correspondence check if not necessary. If SUBQUERY_CHECK_CORRESPONDENCE is true, and some data is found that does not belong here than another query can be executed with no limit option. 2. Introduce only SUBQUERY_APPLY_LIMIT and always check for correspondence. This would introduce some not needed check in case of transactions levels SNAPSHOT or SERIALIZABLE 3. Introduce only SUBQUERY_APPLY_LIMIT and never check for correspondence by default. This should be followed with some documentation that this should be used only if transaction isolation levels are SNAPSHOT or SERIALIZABLE 4. Do not use any options, always apply limit and always check for correspondence. I am in favor of the option 1 as the one with the most flexibility but other options are fine as well. Regards, Ivan |