Re: Delete based on rowid
Date: Mon, 5 Oct 2009 16:17:49 +0530
Thanks for the quick response.
Yes the trace file shows that an index full scan is done for the said DELETE statement.
Ideally Oracle should not have done full index scan considering the steps/logic provided by you.
Another question comes to my mind after going through your response is:
Which method is faster/efficient?
1> Deletion based on rowid
2> deletion based on index values
My application can provide the index values for the deletion as well.
After examining the explain plan I found that the 2nd method above has less cost associated with it.
I had the impression till now that DML operations based on the rowids are the fastest.
On Mon, Oct 5, 2009 at 4:10 PM, Toon Koppelaars <toon.koppelaars_at_rulegen.com
> Am asking this because in my case Oracle is doing a full index scan
> Can you elaborate on that? Is the explain plan (or better tracefile) for
> that delete statement showing a full index scan?
> I would expect the following to happen:
> 1) Oracle fetches the row directly using the rowid supplied in the delete
> 2) Oracle reads all indexed column values of the fetched row, and uses
> these to delete the entries in the corresponding indexes.
> 3) Oracle deletes the row from the table.
> On Mon, Oct 5, 2009 at 12:34 PM, DBA Deepak <oracle.tutorials_at_gmail.com>wrote:
>> Have a simple question.
>> When we delete a row based on rowid from an indexed table, how the index
>> entry gets deleted?
>> DELETE t WHERE rowid='<some rowid>';
>> Am asking this because in my case Oracle is doing a full index scan. Can
>> we say deleting an indexed table based on rowid may not be the fastest way
>> of deleting a row?
>> Please comment...
> Toon Koppelaars
> RuleGen BV
> www.RuleGen.com <http://www.rulegen.com/>
> (co)Author: "Applied Mathematics for Database Professionals"
-- Regards, Deepak Oracle DBA -- http://www.freelists.org/webpage/oracle-lReceived on Mon Oct 05 2009 - 05:47:49 CDT