Wednesday, November 16, 2005

Cost-Based Oracle Fundamentals

Probably one of the two best books about Oracle this year is…. Cost-Based Oracle Fundamentals by Jonathan Lewis. I’ve seen a couple of other blogs out there that say the same and I do agree.

This book is, well, in a word – amazing. If you have ever been baffled or bemused by “why the heck did the optimizer do that”, or as Jonathan wrote on page 299:

I am reluctant to call something a bug unless I can work out what Oracle is doing and can prove that it’s doing something irrational. Too many people say, “It’s a bug” when they really mean “I don’t know why this happened”.

You will absolutely love this book. In it you will discover the how’s and why’s of the optimizer. Why statistics matter, how they matter. What’s up with histograms – when and where do we need them, what affect do they have.

Sprinkled throughout the book are random insights like this one:

There are many ways to implement Oracle systems badly, and as a general rule, anything that hides useful information from the optimizer is a bad idea. One of the simple, and highly popular, strategies for doing this is to stick all of your reference data into a single table with a type column. The results can be catastrophic as far as the optimizer is concerned….

And then is goes on to say why. That is what I really really like – it goes on to say why. I hate it when statements are made and no reasoning is made “why”. You will find none of that in this book.

Jonathan did one thing in this book that I’ll definitely be “stealing” myself. One neat thing is every chapter ends with a list of script names and descriptions. In the text, he references these script names as well. That way, when you download the code – you have a straight reference to the sample you should be running. I’ve used the (extremely poor) naming convention of “demo001.sql”, “demo002.sql” and so on. Next book – they’ll all have names and I’ll be referencing exactly like he did. Very nice.

The attention to detail, the simplicity of presentation (I don’t care what level of Oracle user you are – you will be able to read this book and get it). If you are ‘advanced’ (ok, I’ll put myself into that category), you’ll learn things you did not know before. If you are ‘beginner’, you’ll know lots more than some advanced people after reading it. The surprising thing? It isn’t that hard. Well, it wasn’t to me anyway – maybe the math background I have helped. You do not need 10 years of experience with Oracle to get this stuff, and if you have 10 years of experience with Oracle – you will get new knowledge you never had.

I’m on my second scan of it – re-reading things that I didn’t fully absorb. What I’ll be doing lots in the future is referring to it. I got the gist of everything, I know where to go when I need to explain “why”. Or maybe I’ll just post the link to the book.

And remember, this is “I” of “III”, two more to come…


Anonymous Anonymous said....

"one of the two best books about Oracle this year...."

Which is the other btw?

Wed Nov 16, 07:23:00 PM EST  

Blogger Thomas Kyte said....

Which is the other btw?

ha ha ;) the other would be mine of course.

Wed Nov 16, 07:39:00 PM EST  

Blogger Doug Burns said....


"Probably one of the two best books about Oracle this year is…"

1) Two best books about Oracle *any* year!

2) I'm reading yours after Jonathans because I already had the first version of Expert One-on-One and I knew Jonathan's would be something completely new for me. But you're next ;-) (God, what a great year it's been for books - Chris Date's, yours, Jonathans and others. It's difficult to keep up with work and the books too ...)

3) I think your introduction was perfect for the book, btw, very restrained but highlighted the importance of 'why' - much like the book itself. I agree that Jonathan doesn't make things too hard, but maybe it requires careful reading at some points. You're bang on about the constant insights too - I found myself learning new bits and pieces all the time and they were explained so simply.

As you said - 'amazing' and hopefully the fact that you were able to learn things from it will encourage a lot of the people who visit your site to buy it.



Wed Nov 16, 07:53:00 PM EST  

Anonymous Anonymous said....

Can I ask you , before buying, if this teaches the fundamentals,, right from the basic concepts that I am looking for in this specifically 'Optimizer' book?

Wed Nov 16, 08:04:00 PM EST  

Blogger Thomas Kyte said....

Can I ask you...

I did not fully understand the question.

This book is 100% about the optimizer and how what you DO in YOUR implementation actually *matters* to the optimizer.

It is all about the optimizer.
It is all about your decisions, your design, and what impact that will have on the optimizer.

Wed Nov 16, 08:10:00 PM EST  

Anonymous Krish said....

Jonathan Lewis' Practical Oracle 8i was an amazing book. It had a certain "fresh" feeling to it. It continues to be relevant today.

Can't wait to get my hands on the new one! If only the folks at can get it in stock.

By the way, Tom, thanks a lot for your new book. I am going through it now and it is both highly readable and highly informative. Great Job! Now please hurry up with the Part 2 !!

Wed Nov 16, 08:18:00 PM EST  

Anonymous Anonymous said....

"I did not fully understand the question "

Sorry,Tom, I couldn't get that straight before. I'm actually looking for a book that elaborates the fundamentals of Optimizers, Hints and Indexes. I repeat 'fundamentals'. I bought all your books but felt those topics in question are a little more comprehensive than my reach.

I once was a total techinal guy but had to shift to business side ,however, the itch to keep up with the technical stuff still remained to be scratched.

I bought a few O'Reilly books on those topics before but they didnot serve my expectations.

What I am really looking forward is a book from you that is quite much like, you know, "Cost-Based Optimizers by Thomas Kyte for $9.99 ", "Oracle Indexes by Thomas Kyte for $9.99 "

Wonder if that ever happens ;-)

Wed Nov 16, 09:07:00 PM EST  

Blogger Thomas Kyte said....

I'm actually looking for a book that elaborates the fundamentals of Optimizers, Hints and Indexes.

this book is on the fundamental of the "oracle" optimizer.

It is NOT about hints
It is NOT about indexing

It is about understanding (and those other things, in my opinion, fall out of *understanding* the rest - no "bullets made of a semi-precious metal" exist)

Wed Nov 16, 09:43:00 PM EST  

Anonymous Anonymous said....

Sorry, Tom.

Your latest is sitting on my desk until JL's is completely read. I absolutley loved "Expert One on One". The section of "readers don't block writers and writers don't block readers is such a seminal section of text ... many a developer in need of a clue has had that force fed ... If I ever got a tatoo .. it would be "Readers don't block writers ..."

oh yeah, and "No leftovers".

Between IOUG, RMOUG, Hotsos and 3 days of Jonathan's "optimising oracle" locally here in nyc, I see no reason to hit an airport ever again for an oracle conference.

I do feel a bit slighted in that instead of paying big bucks for his insight, that anyone can buy his (latest) book instead of attending his classes.

Then again, I'm only on Chapter 4 of "Cost-based Oracle Fundamentals" and its only vol 1 of 3. I've only seen about 4 items of "so that explains that behavior" so far each which would have been worth an 8 hr consulting gig.

As far as the guy that asked about fudamentals type things ... dude, read the freaking concepts manuals and then the admin guide, then the performance tuning guide. Do you really need references from Esteemed Gurus to point these out to you for them to be worth your time?

due diligence et al.


Thu Nov 17, 01:29:00 AM EST  

Blogger melanie caffrey said....

One neat thing is every chapter ends with a list of script names and descriptions. In the text, he references these script names as well. That way, when you download the code – you have a straight reference to the sample you should be running.

This is one of Jonathan's techniques left over from the 3-day seminars he gives.

The script CD he provides with all of his class materials is highly coveted, indeed.

Thu Nov 17, 08:15:00 AM EST  

Blogger shrek said....

funny thing, i just got work to order this book for our dba library after much arguing. and i'm about half way through the same thing for yours. all 3 volumes.

the only thing i cna say is "write faster dude, i need all the help i can get.";-)

Thu Nov 17, 08:19:00 AM EST  

Anonymous Carlos said....


I'm just waiting for your book to arrive (I ordered it at Amazon a couple of weeks ago) and now, following the link you provided, I find:

"Better Together
Buy this book with Expert Oracle Database Architecture: 9i and 10g... by Thomas Kyte today!".




Thu Nov 17, 08:46:00 AM EST  

Blogger Jan said....


Estimated Arrival: Nov 30, 2005

After thanksgiving :-( Though I'm sure my wife won't feel too bad about that!

Ordered it with "The Daily Show with Jon Stewart Presents America (The Book): A Citizen's Guide to Democracy Inaction". That book is hilarious!

PS. It was great to finally attend one of your presentations, yesterday in Houston, Tom! Doesn't all this traveling wear you out?

Regards, jan

Thu Nov 17, 09:53:00 AM EST  

Blogger Alberto Dell'Era said....

I agree that the book is surprisingly easy to read - and the CBO is for sure the most complex part of Oracle.

But what I liked the most is the 100% precise description (even the impact of the version on the cost rounding is taken into account ...); something you normally find in Physics books only.

Thu Nov 17, 09:56:00 AM EST  

Anonymous Scot said....

Got my copy 2 or 3 days ago. I had pre-ordered it from Bookpool when they did that Apress Rebate promotion last month (also picked up the oaktable book, since Apress was just giving away money).

I'm already through the ENTIRE first chapter :)

Thu Nov 17, 01:27:00 PM EST  

Anonymous paul said....

Probably? Tom, surely you meant Probably the best (lager)

Thu Nov 17, 04:27:00 PM EST  

Anonymous Anonymous said....

In the text, he references these script names as well.

Where's a natural v. synthetic key argument when you need it? :-)

Thu Nov 17, 04:50:00 PM EST  

Anonymous Anonymous said....

Who is better Tom or Jonathan........? Can we have poll.......

kidding..Both are equally good

Fri Nov 18, 08:02:00 AM EST  

Anonymous Anonymous said....

Who is better Tom or Jonathan......? let's have a poll..

Kidding. Both are equally good.

Fri Nov 18, 08:04:00 AM EST  

Anonymous Anonymous said....

I find it impossible to read a heavy, 500 to 1,000 plus page book printed in a tiny font. Seriously, do people really read these books? Where do you read them? You can’t travel with it because it is too heavy. You can’t leave the book open – at least for the first and last few hundred pages - because it folds back closed. I’m too busy at work to take an hour to read at my desk.

What I am really looking forward is a book from you that is quite much like, you know, "Cost-Based Optimizers by Thomas Kyte for $9.99 ", "Oracle Indexes by Thomas Kyte for $9.99"

I totally agree. Make it 8.5” x 11” with a spiral binding, 25 pages max and use a large font. Now that’s a “book” I can read.

Fri Nov 18, 11:10:00 AM EST  

Blogger Thomas Kyte said....

I find it impossible to read a heavy

based on feedback, yes, at least a couple of people have actually read them.

A 25 page book, I doubt it.

And the font size in the referenced book (and my recent book as well) is hardly what I would call small.

I sort of traveled with Jonathan's book (as well as other books to read) around Europe and the US. It weighs a lot less than my laptop does.

Fri Nov 18, 12:31:00 PM EST  

Anonymous Patty C said....

I went to to order this book and the 'Related Music' section suggested that I would also like the CD 'Ladies Love Oracle' by Grant-Lee Philips. But, I already know that I love Oracle. LOL

Fri Nov 18, 01:55:00 PM EST  

Anonymous Rob H said....

I've started reading Lewis' book and I like it, but I think its easy to get too far into a problem with things like the optimizer.

I just finished a query tuning issue where the developer was excessively using a "NOT IN" sub-select on a table (that he was also using to drive the main select). His problem was that he "believed" the optimizer was confused because it didn't use his index. He spent a lot of time figuring what the optimizer was trying to do and "tricking" it.

In the end a very simple re-write of the query changed it from hours to minutes (more likely seconds).

He missed the fundamentals of SQL because he was pre-occupied with the optimizer.

Fri Nov 18, 03:12:00 PM EST  

Blogger Thomas Kyte said....

but... if he know how the optimizer functioned, he might have known the optimizer wasn't "confused", only that it wouldn't be able to get from there to here - and would have known that (and would have started looking for alternative methods)

it is easy to get to far down ANY rathole - this is true.

Fri Nov 18, 03:17:00 PM EST  

Anonymous Anonymous said....

any idea whats jonathans other two books which are supposed to be released are ??

just curious ?

Fri Nov 23, 12:26:00 AM EST  


<< Home