Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> ROWID always increase for insert-only table?
Hello all,
We had a complaint today from financial dept. about some long-made
reports not being orderded correctly by date as usual. By further
inspection, I realized that instead being ordered by the DATE column
of the table, the select was being ordered by ROWID, since the table
is very large.
The person who did it made the assumption that, since using ROWID
for ordering is much faster than using a common column, and the table
never gets deleted or updated (inserts only), it would make sense to
use ORDER BY ROWID instead of ORDER BY DATE_COLUMN .
When I tried to reproduce the select on SQL*PLUS, showing the rowid,
it really gave me the wrong order. After that I tried this select:
select max(ROWID) from table
and it also returned the wrong row (a rowid from a row inserted on the table on 1999, when there are many records inserted on 2000 after that one), showing that the greatest ROWID really was not assigned to the last inserted row in the table.
So, I had to change the 'order by' clause to use the date column, and everything worked again except by the fact that the report is much slower now.
As I always believed that it should be true, can someone explain me the reason of this? We were using 7.3.4 when the report was made, and today we use 8.0.5 .
Thanks for the help,
Luis Derani ( lderani_at_uol.com.br )
Syst.Analist
Universo Online - SP - Brazil
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Fri May 05 2000 - 00:00:00 CDT