Dirty reads (splitted from "NO LOCK?") [message #571723] |
Thu, 29 November 2012 10:15 |
|
nimdil
Messages: 6 Registered: November 2012
|
Junior Member |
|
|
While it's true in Oracle conflict between reads and writes are not possible, it's not true that NOLOCK/READ UNCOMMITTED is not needed. What if someone needs to check the content of the table at the moment with all their dirty records? versioning-based READ COMMITTED is not perfect and READ UNCOMMITTED had it's uses. It's a real shame they are completely removed.
|
|
|
|
|
Re: NOLOCK? [message #571733 is a reply to message #571731] |
Thu, 29 November 2012 11:54 |
|
Michel Cadot
Messages: 68730 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
And how is this different if you know or not for the business?
This is NOT a business need.
If you REALLY need this for your business then add a trigger on INSERT (for instance) but I doubt this is worth the cost.
Regards
Michel
[Updated on: Thu, 29 November 2012 11:55] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
Re: NOLOCK? [message #572232 is a reply to message #571726] |
Fri, 07 December 2012 14:24 |
|
renriquez
Messages: 2 Registered: December 2012
|
Junior Member |
|
|
Hi
so, what would be the design to solve the problem where you need to know if a transaction is in place, but you don't have rights on the Oracle database to query v$transaction??? I mean, we don't need to know what kind of work is being done (update, delete), nor what rows are being worked on, but only need to know that the work is being executed, and I need to take care of the scenario where my front-end may be shutdown
Scenario??? In a web application, we start a background task when the user clicks a button. In the background task, we start a transaction. The user can then go home, and be back hours later to access the page. If the transaction has finished, the button must be available again. I first thought to put a flag in a table, and then, through dirty read, get the flag value each time the user accessed the page. Should I carry the flag over to a file (static var is discarded)??? How have you solved this kind of situation???
Thanks in advance
|
|
|
|
Re: NOLOCK? [message #572234 is a reply to message #572233] |
Fri, 07 December 2012 17:25 |
|
renriquez
Messages: 2 Registered: December 2012
|
Junior Member |
|
|
Hi Michel
Ajax is not a problem, nor it is to disable the button. Let me give you some more details:
The query is going to take a few minutes (may be hours, it all depends on how the client is going to have the sql implemented). Once the process has started, nobody else can start it again, until it finishes.
Should we register the beginning of the transaction and then commit, the risk exists that an error causes the app to crash while the transaction is running. The next time someone gets to the page, we would check if transaction is started, which would be "Yes", cause the registration was not part of the transaction and, since app crashed, it could not reset that flag.
With dirty read, the flag would be set as part of the transaction, but since we could read it, no matter if the app crashes: if the transaction complete or fails, the flag would be there for us to read.
I don't argue if dirty reads are good or bad, or if the Oracle's design is the better or it isn't. What I want to know, is how do you handle this scenario. What the alternative is??? how to design for this flow???
Thanks for your response
|
|
|
Re: NOLOCK? [message #572238 is a reply to message #572234] |
Sat, 08 December 2012 01:25 |
|
Michel Cadot
Messages: 68730 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
Quote:Should we register the beginning of the transaction and then commit, the risk exists that an error causes the app to crash while the transaction is running. The next time someone gets to the page, we would check if transaction is started, which would be "Yes", cause the registration was not part of the transaction and, since app crashed, it could not reset that flag.
Yes and? It all depends on how you design your application; we can't talk there in the void without something real, an actual spepcification, I don't see anything here that requires dirty read. In a relational database, everything has a primary key, above all a business transaction, lock the key during it.
With dirty reads you are trying to workaround a bad design or implementation using a tachnical dodge.
Note: I will split this part about dirty reads from the original NO LOCK question as it has nothing to do with it.
The new topic will be called: "dirty reads"
Regards
Michel
|
|
|