Skip to Main Content
  • Questions
  • update query in oracle when sga size is small and table data is huge

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, rakesh.

Asked: June 01, 2017 - 9:04 am UTC

Last updated: June 02, 2017 - 2:23 am UTC

Version: 11.2.0.4

Viewed 1000+ times

You Asked

Hi ,

My sga size is 5 gb and my table data is 20 gb , when i run update statement on table how it will fit in sga and how oracle work .
Please explain ?

Thanks,
RP.

and Connor said...

Here's a simple metaphor.

I want to empty a swimming pool ("delete") but I only have a bucket ("small sga"). How do I do it ?

- Well, I get one bucket of water, and tip it out.
- Then another bucket of water, and tip it out.
- And so on...and so on.

The same applies here.

(a) I'll read some blocks into the buffer cache, modify them as per the update
(b) I'll read more blocks into the buffer cache, modify them as per the update
(c) Now when I go to read more blocks, the cache is full.
(d) So I'll flush some blocks out (if they are untouched, I'll just discard them, if they are dirty, ie, altered, I'll flush them back down to disk)
(e) Now I have room for more blocks, go to (a)

When we change data, we do not "queue up" all the changes and only do them when we commit. We actually go ahead do the changes as they are needed. That's why a commit is very fast.

The price of that is that if you rollback, we have to undo all that work. Which is why a rollback can be very slow (and resource intensive)

Rating

  (1 rating)

Is this answer out of date? If it is, please let us know via a Comment

Comments

A reader, June 02, 2017 - 5:53 am UTC