Updating table in sql
The rowid_script shown below gives an example of this.
The script creates a test table as a copy of the all_objects view and then loops through the table twice updating each row at a time.
During the first pass the rows are updated using the primary key value, whilst the rowid is used in the second pass. The next section will show how the order of logical expressions and branching structures can affect the performance of code.
The sampling amount varies depending on the size of the table, but it can be as little as just a few percent to as much as 100% of the table.In these circumstances placing the quickest or least expensive tests first result in quicker performance, as we will now see.The slow_script creates an artificially slow function by using the dbms_lock.sleep procedure.Each rowid represents the physical address of a row within the database and as such is the quickest way to access the row.In processes where data is rapidly selected and updated the use of rowids can improve performance.