Mass Removal of Readuncommitted

Mass Removal of Readuncommitted

Post by Jeff Schaefe » Sat, 01 Jun 2002 00:16:28



I have the "pleasure" of removing the "with readuncommitted" hint from
dozens of stored procedures in a database. The client had a previous
developer who added that query hint as a way to deal with resource
contention issues. Queries were timing out and deadlocking. So, rather
than optimizing the queries and taking other reasonable and
well-documented steps to eliminate blocking and dead locking, the
previous developer simply added "with readuncommitted" to *every* select
statement in each of dozens of stored procedures. Now, all kinds of odd
behaviour is being observed. I have now been given the task of fixing
things.

My questions:
1. What would be the safest way to proceed - simply remove all the
hundreds of readuncommitted hints at once and see what happens? I am
inclined to remove them from logically related subsets of the queries,
monitor performance, and then proceed with the next subset of queries.

2. Other than looking for deadlocking, blocking and timeouts, what are
some other beneficial ways to monitor the effects of my changes? What
should I be looking for?

3. Any other suggestions would be greatly appreciated.

Thanks in advance...

 
 
 

Mass Removal of Readuncommitted

Post by Mary Chipma » Sat, 01 Jun 2002 08:15:23


Is the application in production while you're trying to fix it? If so,
then I wouldn't just remove readuncommitted from every stored
procedure and then watch as things fall to pieces.  Make use of the
Profiler to take a look at the application so you can pinpoint the
problem areas. See if you can target the most critical queries, or the
ones that had the most problems. If the app has such serious problems
that it could only operate using dirty reads, then the problem may be
deeper than simply fixing stored procedures. Is the database
normalized? If not, you may be looking at a complete re-write. I've
seen those kind of apps before in my career, and I've never seen one
yet whose underlying design flaws could be overcome by re-writing code
later. If you determine that the design is the problem, then get
whoever is paying the bills to commit to a re-write now before they
sink more money into a lost cause.

One other cause of deadlocks is not accessing resources in the same
order (process1 starts a transaction and grabs an exclusive lock on
resource1, process2 starts a transaction and grabs an exclusive lock
on resource2. Process 1 needs resource 2 to complete--process 2 needs
resource 1 to complete). That, at least, is fixable in your stored
procedure code.

-- Mary
MCW Technologies
http://www.mcwtech.com

On Thu, 30 May 2002 08:16:28 -0700, Jeff Schaefer


>I have the "pleasure" of removing the "with readuncommitted" hint from
>dozens of stored procedures in a database. The client had a previous
>developer who added that query hint as a way to deal with resource
>contention issues. Queries were timing out and deadlocking. So, rather
>than optimizing the queries and taking other reasonable and
>well-documented steps to eliminate blocking and dead locking, the
>previous developer simply added "with readuncommitted" to *every* select
>statement in each of dozens of stored procedures. Now, all kinds of odd
>behaviour is being observed. I have now been given the task of fixing
>things.

>My questions:
>1. What would be the safest way to proceed - simply remove all the
>hundreds of readuncommitted hints at once and see what happens? I am
>inclined to remove them from logically related subsets of the queries,
>monitor performance, and then proceed with the next subset of queries.

>2. Other than looking for deadlocking, blocking and timeouts, what are
>some other beneficial ways to monitor the effects of my changes? What
>should I be looking for?

>3. Any other suggestions would be greatly appreciated.

>Thanks in advance...


 
 
 

1. Mass inserts -- was: mass updates

Just a few more questions to the DSS-type SQL people out there . . .

There was a change in requirements.  Instead of in-place updates for the company number, management has requested that I leave the
'original' records in the table (for data verification through reporting).  What I'm ending up with at this time is . . . .

1.   Drop indices / PK / FK constraints.
2.   Create 'holding tables' as raw -- (shaved 30% off my trial runs with 100000 rows)
3.   Select information from live table, join with mapping table based on company / store number, insert into holding table.
4.   Process information in holding table -- update company number with new company number, drop new company column (after changing
raw table to standard).
5.   Somehow get the information back into the live table.

For step 5, the ideas that I have are
a.   'insert into live_table select * from holding_table'.  This is the cleanest, but depending on the logical log requirements . .
. .

b.   alter table live_table type (raw); insert into live_table select * from holding_table.  Should be much faster than 'a', but
cleanup in the event of an error . . . . .<?>

c.   unload to holding_table.unl select * from holding_table -- (use dbload to load into live_table.  The more foolproof way . . .
no logical logging issues and I could even keep all indices and RI constraints intact, but data movement would be slow (especially
when talking about millions of rows).

As an aside . . . I think that I can execute this process with a single SQL script, since I'll be setting DBACCNOIGN to abort if
there is any problems.  Any qualms about this approach, or should I wrap this into a 4GL program?  

Any ideas or things I may have overlooked?

2. OS_AUTHENT

3. Problems With ReadUncommitted

4. looking for Oracle8i 8.1.6 JDBC driver for NT

5. Nolock vs Readuncommitted

6. Calculate before Roll-up

7. ReadUncommitted (DirtyRead) possible in Oracle 8.0.5?

8. How to save recordsets in a file .mdb or .xls

9. Relationship removal through SQL

10. need help with if statements on generic duplicate removal procedure

11. Duplicate removal

12. Identity columns removal

13. Registery entry removal