Entries in Tuning (7)

Tuning Leading '%' Queries - a simple approach

Posted on Friday, September 19, 2008 at 02:42PM by Registered CommenterKarl Reitschuster in , | CommentsPost a Comment | EmailEmail

Hi reader,

usually queries using LIKE and leading '%' cannot be indexed. So an idea would be to mirror the string content with the string reverse function to be able to put the '%' operator at the end :

Click to read more ...

Cardinality and Pipelined Functions - Ugly!

Posted on Monday, August 4, 2008 at 10:27AM by Registered CommenterKarl Reitschuster in , | CommentsPost a Comment | EmailEmail

Dear reader,

pipelined functions are very comfortable to process incoming data and to return it as structured result set. For this reason they are frequently used in SQL; But be carefully if you join result sets from pipelined function with other tables.

The Oracle optimizer usually uses gathered table statistics to calculate the cardinality of a join operation; For a result set  originated in a pipeline function it has no statistics to evaluate and hence could try to get another path to the data. 

Following SQL retrieves internal employee GUID's from external Id's passed as comma delimited string.

Click to read more ...

Stream your data!

Posted on Tuesday, January 29, 2008 at 07:39AM by Registered CommenterKarl Reitschuster in , , | CommentsPost a Comment | EmailEmail

Supporting a CRM System with Interface data all Interface jobs log their activity into the Applications EVENTLOG table. It's interesting to know when the interface was started dependent on file delivery of other systems, how long it needs to process the incoming data and how many errors/warnings occurred during processing. The first blueprint to accomplish this I wrote the following SQL. It worked fine with about 50,000 rows. In production - we extended the maximum life cycle of eventlog rows to 90 days the SQL now needed about 280 seconds. The EVENTLOG table in production had about 450,000 rows.

Click to read more ...

Oracle Performance predicatable ?

Posted on Monday, October 22, 2007 at 07:20AM by Registered CommenterKarl Reitschuster in | CommentsPost a Comment | EmailEmail

Hi reader, after Migration of an Oracle Database from AIX 5.3 to Sun Solaris 5.10 and from Oracle 10.2.0.2 to 10.2.0.3 I made some tests with Parallel query performance on the new platform. Following query was executed with parallel degree 4 and then with parallel degree 8; The query itself was generated with the DBMS_STATS package to gather statistics for an index of a partitioned table.

Click to read more ...

Successfully launch of a new data interface or The egg preceded the chicken

Posted on Wednesday, August 15, 2007 at 07:13AM by Registered CommenterKarl Reitschuster in , | CommentsPost a Comment | References1 Reference | EmailEmail

Dear reader, i created a data interface for new demand of incoming data exchange from another system. Finally before the new Interface was released to production i took some tests on a production clone database. Usually in development the interface processed 6m rows in about 15 minutes. But on the clone database the processing did not end after hours. After some analysis i found out that the interface related tables had statistics gathered before processing and resulted in 0 rows per interface table.

Click to read more ...

Explain Plan - What you see is sometimes not what you get

Posted on Monday, July 23, 2007 at 10:14AM by Registered CommenterKarl Reitschuster in | Comments4 Comments | References3 References | EmailEmail

Updated on Wednesday, August 1, 2007 at 12:58PM by Registered CommenterKarl Reitschuster

Dear reader, today support called me because of user complained about a slow system. This time I took a look into the V$SESSION_LONGOPS view which helps to find sessions running SQL lasting longer then 6 secs. Very soon I found a candidate scanning the application customers table with 6.6m rows. With the SQL_ID I found the SQL in V$SQL and pasted the SQL into an explain plan tool.

Click to read more ...

The LIKE Bind Parameter Dilemma (LBPD)

Posted on Tuesday, February 20, 2007 at 07:36AM by Registered CommenterKarl Reitschuster in | CommentsPost a Comment | EmailEmail

Updated on Thursday, October 30, 2008 at 07:50AM by Registered CommenterKarl Reitschuster

hi reader, everybody tells you to use bind variables (reduced parses) and that’s ok. But in some circumstances you get a lot of problems with it. Using bind variables with the LIKE operator could cause horrible performance even you index that column and you do not use a ‘%’ at the start of the searched string. The Optimizer has to calculate the cardinality of an operation. If cardinality changes the execution plan could change dramatically too.

Click to read more ...