Oracle uses object statistics to estimate the amount of data that a query will probably return. This is used to find the best execution plan for the specific case. Having stale statistics is perhaps a major reason for bad execution plans. But sometimes the data changes so frequently that the generation of up to date statistics is not a feasible goal.Continue reading "Faking Oracle statistics for TIMESTAMP columns"
Oracle provides the
DBMS_METADATA package to extract an XML representation of database objects. The generated XML can either be an undocumented internal Oracle format or the so called Oracle SXML format. SXML is a SQL-like XML dialect for Oracle object metadata. The provided interface allow us to extract an object from the database in SXML format and also to convert the SXML format into a DDL statement to create the object again. Since it is basically XML we can go one step further and add an XSLT transformation to modify the object before we recreate it.
This article outlines my findings of using
ROWNUM with the
MERGE statement in Oracle.
The pseudo column
ROWNUM can be used to limit the result set to a specific number of rows. I have used this often when I had to update a lot of rows but needed to keep the size of the transaction fairly small. Systems using data replication like Materialized Views or Streams get easily out of sync when they have to cope with huge transactions.
MERGE statement can be used to reconcile two data sets. A new row is inserted if the key is not available in the target table and it gets updated if it already exists.
Have you ever tried to use both at the same time?Continue reading "No MERGE with ROWNUM"