Author Archives: Bobby

About Bobby

I live in Chandler, Arizona with my wife and three daughters. I work for US Foods, the second largest food distribution company in the United States. I have worked in the Information Technology field since 1989. I have a passion for Oracle database performance tuning because I enjoy challenging technical problems that require an understanding of computer science. I enjoy communicating with people about my work.

Slow insert into stattab with extended statistics

We have hit what is probably a bug on our 11.1 database.  Our optimizer statistics gathering job has been running for hours and consuming a ton of CPU resources.  When we look at an AWR report for this period of … Continue reading

Posted in Uncategorized | Leave a comment

Two ways to see predicates added by VPD or FGAC

We use a feature called “Virtual Private Database” or VPD on our 11g database.  This looks a lot like what used to be called “Fine Grained Access Control” or FGAC on our 10g database.  The idea behind both of these … Continue reading

Posted in Uncategorized | 1 Comment

Newer sqlplus versions give better plan output

This is another funny thing I’ve been doing wrong for years.  I’ve been using an older version of sqlplus and missing out on the improvements made in the way autotrace displays a query’s execution plan. Apparently somewhere around the version … Continue reading

Posted in Uncategorized | Leave a comment

Three ways to get a plan with dbms_xplan

Click here to get a zip of the three different scripts I talk about in this post. There are two different functions in the Oracle supplied package DBMS_XPLAN that I use all the time for tuning SQL queries, DBMS_XPLAN.DISPLAY and DBMS_XPLAN.DISPLAY_AWR. … Continue reading

Posted in Uncategorized | 10 Comments

Example of sql performance degrading as data grows

Ran into an example this week using my sqlstat.sql(updated) script to see how a query’s performance changed over time.  Notice that the average disk reads per execution is steadily increasing as is the average elapsed time per execution:      select … Continue reading

Posted in Uncategorized | Leave a comment

DBA_HIST_SNAPSHOT BEGIN and END_INTERVAL_TIME

They say you learn more from your mistakes than your successes.  I’ve been making a big mistake with a script I was using to tell how many logons had occurred between two AWR snapshots.  I don’t want to lead anyone … Continue reading

Posted in Uncategorized | Leave a comment

Working on Performance Toolkit

I’m working on a performance toolkit with a coworker of mine. It is great to have someone else to use the tools I’ve been using, streamline them, and document them for the rest of our team. To figure out what … Continue reading

Posted in Uncategorized | 1 Comment

Fast way to copy data into a table

I have this test script I use to remind myself of the fastest way I’ve found to copy data into an Oracle table.  It shows three things: Fast way to create a new table populating with data Fast way to … Continue reading

Posted in Uncategorized | 5 Comments

Script to show change in query execution

Click here for a simple but useful script that shows how the execution of a given query has changed over time. (current version). This script just queries DBA_HIST_SQLSTAT for a given sql_id. A sql_id corresponds to a single SQL query.  … Continue reading

Posted in Uncategorized | Leave a comment

Script to extract plans from AWR

I use this script all the time to get the plans for a given SQL statement I’ve identified from an AWR report: getplans.sql Recently I’ve found out that you can do something like this with the delivered awr script $ORACLE_HOME/rdbms/admin/awrsqrpt.sql … Continue reading

Posted in Uncategorized | 1 Comment