Oracle Scratchpad

August 31, 2010

Filter “Bug”

Filed under: Uncategorized — Jonathan Lewis @ 7:01 pm UTC Aug 31,2010

Here’s an example to remind you how important it is to look at the “Predicate Information” supplied with an execution plan. Here are two execution plans that look very similar in shape – a continuous set of steps inwards and downwards from parent to child, with no “multi-child” parent rows:
(more…)

August 29, 2010

Fair Comparison

Filed under: Performance — Jonathan Lewis @ 6:19 pm UTC Aug 29,2010

From time to time someone will post a question about query performance on the OTN database forum asking why one form of a query returns data almost immediately while another form of the query takes minutes to return the data.

Obviously there are all sorts of reasons – the optimizer is not perfect, and different transformations may take place that really do result in a huge differences in work done by two queries which return the same result set – but a very simple reason that can easily be overlooked is the front-end tool being used to run the query.
(more…)

August 27, 2010

Quiz Night.

Filed under: Infrastructure,Performance — Jonathan Lewis @ 6:52 pm UTC Aug 27,2010

I was on a customer site recently where I needed to add a NOT NULL constraint to a table of 200 million rows – without taking any downtime. It’s not difficult (provided you are happy with a check constraint rather than a column definition.)

alter table t1
	add constraint t1_ck_colX_nn check (colX is not null)
	enable novalidate
;

The first step creates the constraint and enables it – but doesn’t validate it. This means that future data (and changes) will obey the constraint, but there may be illegal data already in the table that will not be checked. You will have an interruption to service doing this, as your session will wait to lock the table in share mode (mode 4) to add the constraint – so will be blocked by current update transactions, and will block new update transactions. In a typical OLTP system this should result in just a brief pause.
(more…)

August 26, 2010

DMCA

Filed under: Uncategorized — Jonathan Lewis @ 9:41 pm UTC Aug 26,2010

Some readers have noticed that a few links to my blog seem to be broken. Don’t panic, it’s not permanent it’s just the result of Don Burleson losing his temper.

Let me start by telling you about DMCA, the “Digital Millenium Copyright Act”. DMCA is a mechanism designed to protect Internet service providers (ISPs) from being sued over content published by their customers by allowing them to act as a communication channel and staying out of the line of fire.
(more…)

August 24, 2010

Index rebuilds

Filed under: Index Rebuilds,Indexing,Infrastructure,Performance — Jonathan Lewis @ 6:56 pm UTC Aug 24,2010

A couple of years ago I wrote about a poster on the OTN db forum who was puzzled by the fact that when he started rebuilding tables they got bigger.  (Bad luck, sometimes that’s what happens !)

A few days ago a related question appeared: I rebuilt some indexes and my query got slower. (Bad luck, sometimes that’s what happens – again!)

If you rebuild an index it’s physically different and its statistics are different. Plans can change and go slower because the index stats look sufficiently different; plans can stay the same and go slower because the index is physically different. 

I’ve added a couple of comments to the thread – there may still be some further mileage in it.

[Further reading on rebuilding indexes]

August 22, 2010

Cardinalilty One

Filed under: CBO,Infrastructure,Performance,Tuning — Jonathan Lewis @ 6:36 pm UTC Aug 22,2010

I think anyone who has read Wolfgang Breitling’s material about the optimizer will be familiar with the concept of Cardinality Feedback and one particular detail that when Oracle gets a cardinality estimate of one for a “driving” table then there’s a good chance that the execution plan will go wrong. (That’s not rule, by the way, just a fairly common observation after things have gone wrong.)

A recent note on OTN reminded me of a particular scenario where this specific problem can occur. It’s not particularly common, but it may hit people who are building data warehouses from multiple different sources. We start with an unlikely looking data set and very simple query:
(more…)

August 20, 2010

Index Space

Filed under: Indexing,Infrastructure — Jonathan Lewis @ 6:47 pm UTC Aug 20,2010

I’ve just been reminded of a thread on OTN which turned into a Q&A about index space usage and various related topics. On re-reading it, I decided it was too good to waste in the backwaters of OTN, so here’s a link to it.

Index Space Utilization.

August 17, 2010

FBI Bug

Filed under: CBO,Indexing,Troubleshooting — Jonathan Lewis @ 5:42 pm UTC Aug 17,2010

Here’s an odd little bug (I think) in the optimizer that showed itself in a thread on the OTN database forum some time ago. The optimizer can choose an index which is NOT the cheapest index for satisfying a query against a single table. Here’s the demo – which I’ve run against 11.1.0.6 using an 8KB block size, ASSM and system allocated extent sizes:
(more…)

August 15, 2010

Joins – MJ

Filed under: Execution plans,Performance — Jonathan Lewis @ 5:50 pm UTC Aug 15,2010

The final join mechanism in my “all joins are nested loop joins” argument is the Merge Join – a join mechanism that depends on both its row sources being pre-sorted on the join columns. (For a quick reference list of URLs to all three articles in turn, see: Joins.)

(more…)

August 10, 2010

Joins – HJ

Filed under: CBO,Execution plans,Performance — Jonathan Lewis @ 6:43 pm UTC Aug 10,2010

In the second note on my thesis that “all joins are nested loop joins with different startup costs” I want to look at hash joins, and I’ll start by going back to the execution plan I posted on “Joins – NLJ”. (For a quick reference list of URLs to all three articles in turn, see: Joins.)
(more…)

August 9, 2010

Joins – NLJ

Filed under: Execution plans,Infrastructure — Jonathan Lewis @ 11:57 am UTC Aug 9,2010

This is part one of my thesis that “all joins are nested loop joins – it’s just the startup overheads that vary”; there will be a note on “Joins – HJ” and “Joins – MJ” to follow. (For a quick reference list of URLs to all three articles in turn, see: Joins.)

(more…)

August 2, 2010

Joins

Filed under: humour — Jonathan Lewis @ 6:13 pm UTC Aug 2,2010

There are only three join mechanisms used by Oracle: merge join, hash join and nested loop join.

Here’s an important thought: all three join methods are nested loop joins with different startup cost.

Discuss.

(more…)

Theme: Rubric. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 819 other followers