Oracle Scratchpad

June 17, 2008

Blog Roll

Filed under: Uncategorized — Jonathan Lewis @ 7:28 pm UTC Jun 17,2008

I’ve added a couple of entries to my link list recently, so I thought I’d give them a quick mention in case you hadn’t noticed them.

Alberto Dell’Era - Lots of material about optimizer join costing, and now a growing collection of interesting pl/sql packages.

ASHMasters - Kyle Hailey, Graham Wood, John Beresniewicz: some of the big names behind ASH who want you to get more out of it.

Tanel Poder - possibly the new Steve Adams.

TED - A site with a number of interesting video presentations that have nothing to do with Oracle.

 

June 10, 2008

Firefox

Filed under: Uncategorized — Jonathan Lewis @ 2:53 pm UTC Jun 10,2008

Here’s an interesting URL that I found by following an incoming link a little while ago.

If you run Firefox as your web browser, this “Customizegoogle” add-in allows you to “filter spammy websites from search results”. (It’s got a lot of other features, but this one seems likely to be the most useful to Oracle users).

I’ve got Firefox on my Linux RAC stack - but I may have to download it for my Windows boxes too, especially the laptop which is the machine I use for most of my writing.

Updated: And here’s a URL that should let you do the same thing with Internet Explorer, too.

June 8, 2008

Scientific Method

Filed under: Uncategorized — Jonathan Lewis @ 9:53 pm UTC Jun 8,2008

I’ve finally found out why I seem to disagree with Don Burleson more frequently that I do with other people on the internet.

From a recent OTN thread:

Me: “you’re supposed to design a theory to match the facts, not select the facts to match the theory.”

Burleson: “I think it’s the other way around, Jonathan, the scientific method requires that you start with a hypothesis.”

So that’s my problem - I let the facts stand in the way of a perfectly nice theory.

 

June 5, 2008

Advert - New Book

Filed under: Uncategorized — Jonathan Lewis @ 4:02 pm UTC Jun 5,2008

I posted an early warning about Christian Antognini’s new book some time back.  Well, it’s now on the shelves. For more details, see this URL to read the forewords that Cary Millsap and I supplied

If you’re waiting for volume 2 of my Cost Based Oracle series, then this is the book you should get to keep you going while you wait. If you’re not waiting for my volume 2, then this is a book you should get anyway.

 

May 16, 2008

Best Practices

Filed under: Uncategorized — Jonathan Lewis @ 7:26 pm UTC May 16,2008

This is a note that I wrote for the Northern California Oracle User Group a few months ago. It was published in the February issue of the magazine in the section “Ask the Oracles”, an interesting and innovative section that I first contributed to in August 2006 with a note on hints.

The topic under discussion in the February 2008 issue was actually”Best and Worst Practices”. These were my thoughts - limited to 600 words:

It’s quite hard to say anything sensible or inspiring about a topic like this. Many of the specifics we call best practices are extremely obvious “common sense” but sometimes circumstances conspire to make it impossible to follow them. Many of the worst practices are things that we should obviously avoid, but again circumstances (often pressures of time) may make them unavoidable.

The worst generic practice I know of, then, is applying a fix to a problem without understanding why that fix might work.

I have a simple approach to problem-solving; it involves three steps:

  • What is the problem?
  • Why will my solution fix the problem?
  • Where am I going to pay for implementing this solution?

The last question will sometimes tell us that we can’t afford to implement the “perfect” solution – perhaps we want to change a heap table to an index-organized table (IOT), but can’t because we have too much code that has done something a little exotic with traditional rowids and needs to be rewritten to deal with the “urowid” used for IOTs.

But before we worry about such side effects, overheads and implementation costs, we need to be confident that our solution really is addressing the root cause; because if it isn’t we may spend time and effort implementing a change which seems to fix our problem temporarily – until things go wrong again.

Take a simple example. A query takes an unreasonable amount of time. You check the execution plan and decide the problem might go away if Oracle used a particular index. So you rebuild the index and the query runs much more quickly. Is your job finished?

No doubt the first thing you do is check the execution plan to see that it changed to use the index the way you expected. But does that prove that the performance improvement came from the change in plan – is it possible that your index rebuild used a table-scan that resulted in the target table being cached somewhere (in the SAN cache, for example) so that accesses to the table during your test were much quicker than they would normally be?

Even if the improvement was due to the change in execution plan, do you know why the plan changed? Was it because the rebuild packed the index giving you a smaller leaf block count (or height even), or was it because index rebuilds automatically compute statistics in your version of Oracle and a small change in the statistics (distinct_keys or leaf_blocks being the most likely) made the difference. Will the new plan survive the next statistics collection – even if the index doesn’t start growing immediately after the rebuild?

If you don’t check, you may end up performing a regular, yet redundant and potentially dangerous, rebuild of this index; and when, exactly, does it need to be rebuilt anyway?

What if the change was due to a change in the distinct_keys, there may be “random” occasions when the rebuild strategy just doesn’t work; or a day may come when the rebuild will no longer work because even the freshly rebuilt index has grown past a critical number of distinct_keys or leaf_blocks.

Whenever you make a change that’s supposed to fix a problem, try to capture the before and after information (e.g. statistics, execution plans, work done, number and type of waits). If there’s any doubt in your mind about the root cause, never be afraid to document what you’ve done, and the reasons why you did it – it may save you a lot of time in the future when your “fix” turned out to have been just a temporary lucky coincidence.

 

May 14, 2008

Happy Birthday!

Filed under: Uncategorized — Jonathan Lewis @ 7:45 pm UTC May 14,2008

This year marks the 25th anniversary of the UK Oracle User Group - and we have a target of 430 presentations covering the many different faces of Oracle’s presence in the IT and business world.

The call for papers has just gone out, with a closing date of May 9th - so if you want to join the fun, sign up soon.

Update:

(1) The closing date has been extended to 20th May - I know it seems early for a conference at the start of December, but there’s a lot of work in putting together an event for 2,500 people and early submissions help a lot.

(2) Since Oracle has just bought BEA, the UKOUG will be putting together a stream for users of their product as well - even if the list of topics in the ‘abstracts’ screen doesn’t include the right label  yet.
 

May 13, 2008

Interesting notes

Filed under: Uncategorized — Jonathan Lewis @ 7:35 pm UTC May 13,2008

This (Oracle-related) blog site caught my eye a few days ago. There isn’t much on it at present, but what’s there is worth reading, so I thought I’d post a pointer to it for a few days.

 

March 20, 2008

Humour

Filed under: Uncategorized — Jonathan Lewis @ 5:01 pm UTC Mar 20,2008

Tom Kyte and Pete Finnigan are both well known for talking about the need to use bind variables and the dangers of SQL Injection. This cartoon must have been written just for them.

January 17, 2008

Book Reviews

Filed under: Uncategorized — Jonathan Lewis @ 9:10 pm UTC Jan 17,2008

Over the last few weeks I’ve read a couple of very good books about database theory and practice. Rather than saying anything about them on the blog, I decided to put my comments into Amazon reviews (UK site).

The two books were: Applied Mathematics for Database Professionals - by Lex de Haan and Toon Koppelaars, and Relational Database Index Design and the Optimizers by Tapio Lahdenmaki and Mike Leach.

The Indexing book is likely to have a more immediate practical impact for DBAs, but the Applied Mathematics book has a wonderful chapter 11 that will be of particular benefit to developers who want to make sure that the only data that gets into their database is correct data.

For American readers, the Amazon.com links (without my reviews, of course, but with reviews from other readers) are: Applied Mathematics, and Indexing.

(This blog item operates in association with Amazon.co.uk and Amazon.com).

January 11, 2008

Targets

Filed under: Uncategorized — Jonathan Lewis @ 10:41 pm UTC Jan 11,2008

Two achievements recorded today:

Some time early this morning (GMT) the blog reach 500,000 visits.  Not too bad for about 14 months - but still running at less than half the rate of the website.

Most popular page, with 6,100 views, is : Cartesian Merge Join  pushing July’s most popular posting, Bind Variables, into second place with 5,900 views.

The other item - an email, also arriving very early in the morning - was the news from Apress that they are preparing another print-run of Cost Based Oracle - Fundamentals. (The email said it was the third run - but so did the email they sent around this time last year so I’m going to call it the fourth print run).

June 1, 2007

Popular Posts

Filed under: Uncategorized — Jonathan Lewis @ 10:35 am UTC Jun 1,2007

A few months ago, I reached 100,000 page views.

Yesterday evening the page view count reached 250,000 according to Statcounter. (According to WordPress it got there about 3 weeks ago - and if you add their figures for page views through feeds, the figure goes up by about 50% .)

In recognition of the landmark, I did a quick trawl back in time to see which were the most popular pages; the two I picked up last time are still there, with a more recent page that overtook them soon after it was published.

In third place, published on 15th Dec 2006, with  2,570 hits: an explanation of why 10g (in particular) could leave statements crashing with Oracle error ORA-01722 when they used to run perfectly well on earlier versions of Oracle.

In second place, published on 13th Dec 2006, with 2,690 hits: my notes on why you might be seeing a lot more Cartesian Merge Joins than you used to in earlier versions.

In first place, published on 5th Jan 2007, with 2,916 hits: an article about bind variables - with some useful feedback from readers.

April 8, 2007

Tempus Fugit

Filed under: Uncategorized — Jonathan Lewis @ 5:14 pm UTC Apr 8,2007

 You may have noticed that I haven’t done a lot of blogging recently. I’ve just been too busy - and somehow I can’t seem to find time for work, life, blogging, and writing another volume of the Cost Based Optimizer trilogy (which seems to be heading in the Douglas Adams direction of becoming a trilogy of more than three parts).

So if you are an avid reader of this blog, don’t despair when nothing appears for a few days - just tell yourself I’m writing a few more pages of Volume 2.  (It might not be true, but it might make you feel more positive about the lack of blog.)

January 21, 2007

UKOUG - Apex

Filed under: Uncategorized — Jonathan Lewis @ 11:53 pm UTC Jan 21,2007

I’m just going to hi-jack my own blog briefly to exercise my role of a director of the UK Oracle Users’ Group.

At the last directors’ meeting, we floated the idea of a special event (one-day) dedicated to Apex, and I volunteered my blog as a way of getting some idea from the user community about whether this would be a useful event, what sort of things they would like to hear about, the type of event they would want, and the degree of support.

As is usual with UKOUG special events, there would be scope for non-members to attend - so even if you aren’t a member, feel free to supply your thoughts.

Blog at WordPress.com.