Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Sybase vs Oracle - which is better?
Karl Zdero wrote:
>
> Well, people saying that its bad to use cursors obviously have not been working
> with large databases.
>
> Example 1 (Sorry the poor pseudo)
> -------------------------------------
> Consider a simple example where you need to update every row in a really HUGE
> table.
> Yes one could simply write,
> UPDATE table SET col='x'
> then wait and wait and wait and the KAPOW the ROLLBACK segment fails and your'e
> back to square one.
> Better then to use a cursor eh!
> open cursor
> while more
> fetch
> update
> if counter = 1000
> commit
> end while
I agree, but in Sybase you would probably get better performance by doing your updates in batches based on some logical table partition. e.g. (in even worse pseudo):
for each months worth of rows
UPDATE table SET col='x' WHERE month = ... commit
>
> Example 2 (a bit more absurd, but can't be done without a cursor)
> ------------------------------------------
> You need to check a table with filenames embedded in the colums.
> You want to remove those rows whose file's no longer exist!
>
> open cursor
> while more
> fetch
> answer = systemcall(does filename exists)
> if answer=no
> delete row
> end while
>
What is wrong with this?
delete from X
where externalProcedureCall(does X.filename exist)
Assuming this is not possible, your cursor solution is probably the best way in Sybase as well.
> -
> Now leads me on to the question why ORACLE is better than SYBASE in this
> regard.
> Simple answer ROWID.
> - Quick access to a record.
> - Quicker than any SQL query
>
> I don't think SYBASE has a rowid.
>
> >
Sybase has cursors as well, but you do not have to use them as often as you do with ORACLE. Received on Tue Dec 01 1998 - 00:00:00 CST