I wrote a few years back that for single row operations, MERGE might in fact have a large overhead than the do-it-yourself approach (ie, attempt an update, if it fails, then do an insert).

Just to show that it’s always good to revisit things as versions change, here’s the same demo (scaled up now because my laptop is faster Smile)

As you can see, there is still a little difference between between the two operations. (more...)

Datatypes for DATES

Richard Foote has written a post about not using the DATE datatype for storing dates.

So I’ve come up with a revolutionary system to store dates as well…using the very efficient RAW datatype.

Here’s a demo

SQL> create table t ( x raw(7) );

Table created.

SQL> create or replace
  2  procedure store_date(p_yyyymmddhh24miss varchar2) is
  3  begin
  4    insert into t
  5    values
  6      (
  7        hextoraw(
  8         to_char(to_number(substr(p_yyyymmddhh24miss,1,2))+100,'FM0X')||
  9         to_char(to_number(substr(p_yyyymmddhh24miss,3,2))+100,'FM0X')||
 10         to_char(to_number(substr(p_yyyymmddhh24miss,5,2)),'FM0X')||
 11          (more...)

Let me START WITH sequences

It’s always cool that you can learn stuff every single day, even on the most simple of topics.  This one came from an AskTom question.  We define a sequence to start with 100, and then alter it to modify the INCREMENT BY.

SQL> create sequence test_seq INCREMENT BY 25 START WITH 100 MAXVALUE 1000 NOCACHE NOCYCLE;

Sequence created.

SQL> @pt "select * From user_sequences where sequence_name = 'TEST_SEQ'"
SEQUENCE_NAME                 : TEST_SEQ
MIN_VALUE                     :  (more...)

Dropping constraint… what about the index?

In a recent release that I’ve been working on, we had to drop and recreate some of the unique/primary key constraints (due to columns being added into the constraint) on some of our tables.

Prior to working in this team, I had only ever come across explicitly creating the indexes for a table, similar to:

create table test_explicit_index (col1 number,
                                  col2 varchar2(30),
                                  col3 date);

create unique index col1_exp_pk on test_explicit_index (col1);

We can see the (more...)

Protected: easyJet Request for reimbursement and expenses, reference: EQ7818W

There is no excerpt because this is a protected post.

Moving from PeopleSoft to the Oracle Cloud

Those of you who know me will know that I’m working at Cedar and we’re moving from PeopleSoft to the Oracle Cloud. I won’t talk about the company’s journey, but more how I’ve found the transition personally.

In brief, there’s a lot to learn.

Data Model knowledge

In the PeopleSoft world, once you know the table structures you could work significantly faster. Whether you were writing an SQR, an App Engine, an XMLP report, a (more...)

Oracle Audit Control part 3 – OS files

Just realized that I wrote a follow-up to Part 2 2 years ago and never posted it! So here’s the stripped-out key facts to round off auditing control a bit more:

Deleting O/S audit files is, like, totally necessary. In Oracle 12C (12.1), they are created by default as AUDIT_SYS_OPERATIONS defaults to TRUE now, so you are going to be filling up your AUDIT_FILE_DEST whether you realized it or not.

[NOTE: In theory, this (more...)

A cool thing with EXCHANGE PARTITION (part 1)

“Common sense” would tell us that if I am running a query against a table, and then all of a sudden I rip out a giant chunk of that table with a DDL command, then either

  • the query should crash, or
  • the DDL command should not be permitted to run.

But in fact, with Oracle, we can even go one better in many situations.  We can allow the DDL and still have the query (more...)


Oracle cost-based optimizer (CBO) is great, but sometimes it’s making wrong choices even when correct inputs are fed to it. In such cases, you need a tool to override CBOs choices, and one of the most popular tools is optimizer hints. The main reason they’re so popular is that they allow “quick-and-dirty” kind of fixes for performance issues (provided that query text can be altered). Other ways may be more reliable, but generally require more (more...)

Those pesky dates as strings

You might be thinking “Nothing is more frustrating that encountering a string column that is full of dates”.

But there is something worse than that…and that is, when that string column is full of potential dates, and your job is to sift out the good data from the bad data. For example, if your table looks like this:

SQL> select * from T;

Jan 14, 2016

6 rows  (more...)

Understanding query slowness after platform change

We are moving a production database from 10.2 Oracle on HP-UX 64 bit Itanium to 11.2 Oracle on Linux on 64 bit Intel x86. So, we are upgrading the database software from 10.2 to 11.2. We are also changing endianness from Itanium’s byte order to that of Intel’s x86-64 processors. Also, my tests have shown that the new processors are about twice as fast as the older Itanium CPUs.

Two SQL (more...)

Last week in Stream Processing & Analytics 5/9/2016

This is the 13th installment of my blog series around Stream Processing and Analytics.

Last week the new release of Oracle Stream Explorer has been release, now under a new name Oracle Stream Analytics. I have written my own blog article about it. This new version is an impressive release with over 15 new major features! It really deserves the name change. Oracle Stream Analytics simplifies stream processing and enables Self Service Streaming Analytics applications (more...)

Oracle Forms Extreme Mobile Makeover Contest



In today’s world, where everything is at the tip of your fingers, why are your enterprise systems glued to your office desk?  Imagine if you could access and operate your Oracle Forms/EBS systems from any location.  What if your Oracle Forms system was so agile, so easy to adapt, that any business function you do in Oracle Forms could be included in a mobile application? What would you include in your mobile (more...)

Comparing Common Queries Between Test and Production

The developers complained that their test database was so much slower than production that they could not use it to really test whether their batch processes would run fast enough when migrated to production. They did not give me any particular queries to check. Instead they said that the system was generally too slow. So, I went through a process to find SQL statements that they had run in test and that normally run in production (more...)


The OTN database forum supplied a little puzzle a few days ago – starting with the old, old, question: “Why is the plan with the higher cost taking less time to run?”

The standard (usually correct) answer to this question is that the optimizer doesn’t know all it needs to know to predict what’s going to happen, and even if it had perfect information about your data the model used isn’t perfect anyway. This (more...)

OTN Yathra– scenes from Bangalore and Hyderbad

It’s sad that I could not capture in pictures the amazing sights and sounds from both inside the conference and outside in the streets of these amazing places.

I was too busy just absorbing it myself and neglected to take enough pictures Sad smile

But again, a truly wonderful couple of days.

Evolution of Masking Vendors

Screen Shot 2016-04-22 at 12.47.52 PM

Masking with Delphix (where duplicate blocks are shared making a new copy almost free storage wise and almost instantaneous) has 4 big advantages

  1. Instant data, no copying
  2. Ease of Use
  3. Consistent across data centers and databases vendors
  4. Master/Slave

Virtual Data Masking

Delphix masking and virtualization is the most advanced solution in the market place, because Delphix doesn’t provision data. Instead of provisioning data, Delphix sets up pointers back to existing data for a new clone. When that (more...)


It’s been forever since I last shared any of my performance troubleshooting experiences at work. This week, I got a case that I think is worth publishing, and I decided to write about it in my blog. So, here we go…

A few days ago, I received a complaint about unstable performance of one of frequently running SQL reports on a 11gR2 database. Most of the time it completed within a couple of minutes, however, on (more...)

OTN Yathra Chennai

Rather than try to convey in words the first couple of days in India, I thought I’d share some of the images from the first days here in India, covering the Chennai conference. Enjoy


Oracle X5-2, from bare metal to VM Server. Without disks, without dvd drive.

Oracle offers a fine machine called the X5-2. Not to be confused with the ODA X5-2, which comes with sophisticated database software. The X5-2 is just bare metal.

The X5-2 is a 1HE 2 socket Intel machine with limited configuration options in terms of processor speed, number of cores and storage.

I will show you how to install Oracle VM Server software without even having a dvd drive for the installation disk, nor a hard (more...)