Cost-Based Oracle Fundamentals

  Author:    Jonathan Lewis
  ISBN:    1590596366
  Sales Rank:    75326
  Published:    2005-11-05
  Publisher:    Apress
  # Pages:    520
  Binding:    Paperback
  Avg. Rating:    5.0 based on 25 reviews
  Used Offers:    10 from $26.99
  Amazon Price:    $43.22
  (Data above last updated:  2008-11-29 05:56:20 EST)
  
  
Sort customer reviews by:
  
Show All Reviews on Page      Hide All Reviews on Page
   
  
Cost-Based Oracle Fundamentals
  

The insights that Jonathan provides into the workings of the cost-based optimizer will make a DBA a better designer, and a Developer a better SQL coder. Both groups will become better troubleshooters.

— Thomas Kyte, VP (Public Sector), Oracle Corporation

The question, "Why isn't Oracle using my index?" must be one of the most popular (or perhaps unpopular) questions ever asked on the Oracle help forums. You've picked exactly the right columns, you've got them in the ideal order, you've computed statistics, you've checked for null columnsand the optimizer flatly refuses to use your index unless you hint it. What could possibly be going wrong?

If you've suffered the frustration of watching the optimizer do something completely bizarre when the best execution plan is totally obvious, or spent hours or days trying to make the optimizer do what you want it to do, then this is the book you need. Youll come to know how the optimizer "thinks," understand why it makes mistakes, and recognize the data patterns that make it go awry. With this information at your fingertips, you will save an enormous amount of time on designing and trouble-shooting your SQL.

The cost-based optimizer is simply a piece of code that contains a model of how Oracle databases work. By applying this model to the statistics about your data, the optimizer tries to efficiently convert your query into an executable plan. Unfortunately, the model can't be perfect, your statistics can't be perfect, and the resulting execution plan may be far from perfect.

In Cost-Based Oracle Fundamentals, the first book in a series of three, Jonathan Lewisone of the foremost authorities in this fielddescribes the most commonly used parts of the model, what the optimizer does with your statistics, and why things go wrong. With this information, youll be in a position to fix entire problem areas, not just single SQL statements, by adjusting the model or creating more truthful statistics.

                  Reader Reviews 1 - 28 of 28                 
  
  
Review
Date
Review
Rating(5 High)
Review
Helpful
to:
Customer Review Reviewer
Info
Permanent
Link
Reader Reviews Below Sorted by Newest First
08-25-08 5 1\1
(Hide Review...)  Great Book!
Reviewer Permalink
This book contains a wealth of information about how to evaluate and test the Oracle Cost Based Optimizer. Jonathan presents the material in a very easy to follow style. All the examples and scripts that he provides work as written. I would highly recommend this book.
(Review Data Last Updated: 2008-11-30 06:55:04 EST)
07-15-08 5 1\1
(Hide Review...)  Invaluable Oracle Resource
Reviewer Permalink
Jonathan Lewis has perfomed an invaluable service to the Oracle community. He doesn't just offer opinions of how the CBO makes decisions from his vast experience. He also offers the scripts he used to verify behavior of the Oracle CBO. This equips the user to replicate Jonathan's work with newer versions of oracle and adapt the scripts to your circumstances.

Dennis Williams
(Review Data Last Updated: 2008-08-25 16:58:22 EST)
11-08-07 3 (NA)
(Hide Review...)  I was disappointed
Reviewer Permalink
It doesn't mean you won't love the book. I found it to be far too narrow and, even as an Oracle OCP, boringly written. That may say more about me than it does about Jonathin Lewis, who I know is brilliant and has written brilliant stuff before. I just didn't get as much out of it as I thought I would.
(Review Data Last Updated: 2008-07-15 18:03:57 EST)
08-24-07 5 2\2
(Hide Review...)  Jonathan is a tease... but it's a great book!
Reviewer Permalink
Each quarter my team of DBA's has one book that we read and discuss in team meetings. This quarter, Cost-Based Oracle Fundamentals is it. This book is a wholly remarkable book for the moderate to advanced DBA. It is a deep dive into the Oracle optimizer, providing some wonderful insights into not only how it works, but why. It is not a book for the faint of hart, or those waiting breathlessly for retirement. It is a book for those who want to understand the CBO in more depth.

Within the book, Jonathan provides insights into how the CBO *should* work. He follows up often by demonstrating the maturing (or devolving as the case may be) of the CBO from version to version. Beyond his own experimentation and results, he leads the reader into the process that he has followed to come to understand the internals of the CBO, providing a road map allowing the reader to continue to explore the optimizer in future releases.

However, I must take Jonathan to task, for he is a nasty tease. This book was released about two years ago. In it, he leads us on with promises of forthcoming volumes 2 and 3, dangling the carrot out there for us to follow. Sadly, these volumes are yet to be seen. Jonathan! Quit running to and fro filling our heads with knowledge at various conferences and write those books man!

A caution for the new DBA or the cursory SQL developer, you may find this book overwhelming at first glance. For the new or even intermediate DBA, it might be hard to derive practical application of what Jonathan is teaching at first glance. Take your time with the material and the insight that you will gain will be invaluable.

Overall, if you want a book with meat, then this is the book for you. It will expand your mind and the way you look at the Oracle CBO.

(Review Data Last Updated: 2007-11-09 19:46:34 EST)
11-28-06 5 6\6
(Hide Review...)  Invaluable Knowledge and Applicability
Reviewer Permalink
This book gets a prized spot on my technical shelf. It is a challenging read, and has taken the most time of any book I have to get through, but it is quite good. The optimizer is such a core part of what makes Oracle worth the investment, that any DBA who does not understand it is doing a disservice to the company investing such capital into the product.

Lewis' use of proof through example is second to none, and leaves me feeling confident about the knowledge I've gained. His insights are not only theoretical, but quite applicable. I learned much about manipulating and using the DBMS_STATS package, about data model design and why data knowledge is so critical to the DBA.

My nervousness about hints and about upgrades was reinforced with concrete examples that have improved my test plans, upgrade methodologies and overall made me a more competent DBA. I've directly used this knowledge to support my clients in better ways than I would have before it, and that is well worth the price of admission and the time to get through such an in-depth work.

Thanks Jonathan!
(Review Data Last Updated: 2007-04-12 14:33:27 EST)
11-27-06 5 6\6
(Hide Review...)  Invaluable Knowledge and Applicability
Reviewer Permalink
This book gets a prized spot on my technical shelf. It is a challenging read, and has taken the most time of any book I have to get through, but it is quite good. The optimizer is such a core part of what makes Oracle worth the investment, that any DBA who does not understand it is doing a disservice to the company investing such capital into the product.

Lewis' use of proof through example is second to none, and leaves me feeling confident about the knowledge I've gained. His insights are not only theoretical, but quite applicable. I learned much about manipulating and using the DBMS_STATS package, about data model design and why data knowledge is so critical to the DBA.

My nervousness about hints and about upgrades was reinforced with concrete examples that have improved my test plans, upgrade methodologies and overall made me a more competent DBA. I've directly used this knowledge to support my clients in better ways than I would have before it, and that is well worth the price of admission and the time to get through such an in-depth work.

Thanks Jonathan!
(Review Data Last Updated: 2007-04-11 10:36:35 EST)
10-18-06 5 4\4
(Hide Review...)  Another brilliant book by Jonathan Lewis
Reviewer Permalink
This is the book that one definitely needs to read (and understand) in order to get an idea what the CBO is all about.

Jonathan's examples and presentation is excellent. Though the topic is quite intense, the book is quite pleasant to read. This book is a worthy follow up the classic "Practical Oracle8i".

As regards the usefulness of the book in real world scenarios, I can only say that if one wants to approach SQL tuning as a science, one needs to learn the CBO, and this book is essential.

This is volume 1 or 3. I will definitely be eagerly waiting for the next volumes.
(Review Data Last Updated: 2007-07-07 20:02:20 EST)
09-14-06 5 5\5
(Hide Review...)  Excellent Book! Recommended!
Reviewer Permalink
I bought the book "Cost-Based Oracle Fundamentals" and I found it extremely helpful and I've been recommending to other people - both DBA's and SQL writers. I've been pretty good at tuning problem SQL in the past mostly by knowing (or learning) the data and forcing the best plan using hints. But the row estimates/cost figures that the optimizer comes up with have always been a mystery to me. This book explains a lot of what I have been seeing. (The answer is 5%!)

The book is very well laid out and it meant to conceptually show how the optimizer makes decisions and how it can be mislead into making wrong decisions. It also spells out many situations where the optimizer is making a SWAG and indicates where you should pay attention to the explain plans and perhaps hint them so they run properly.

With the suggestions in the book, I have made great strides in fixing our database so that we get rational explain plans from the optimizer. However, we have so many queries based on SYSDATE calculations that I now realize that many of the row estimates (5%) are crap and that frequently this is what has been causing us issues. (I knew that the row estimates were the issue. I just never knew where the harebrained estimates actually came from. Now I can say, "Oh, 7 million. That's 5% of 152 million rows. The optimizer doesn't know how many rows you're bringing back for SYSDATE and SYSDATE-1, so it's using 5%")

Thanks to this book, I can now also show that half the time the CBO has been picking the right plan for the wrong reasons! Who says, "Two wrongs don't make a right?" They do sometimes. Now, as I untangle all this, I have to worry about Oracle suddenly selecting the wrong plan for only one wrong reason! But I've at least been able to explain why the performance of some SQL seems to periodically go haywire and then fix itself without any changes having been made to the SQL.

I have so many more answers and explanations now that when people see the yellow and black book on my desk, they ask me, "Is this the book?" I look forward to the next two volumes in the series.
(Review Data Last Updated: 2007-07-07 20:02:20 EST)
07-08-06 2 5\21
(Hide Review...)  How much of it is useful ???
Reviewer Permalink
I took two days and went through the book. Sounds more like
R&D book rather than something which I am going to use. If you want to learn good SQL tuning, stick with Guy Harrison - it is more practical.
(Review Data Last Updated: 2007-07-07 20:02:20 EST)
07-07-06 2 4\17
(Hide Review...)  How much of it is useful ???
Reviewer Permalink
I took two days and went through the book. Sounds more like
R&D book rather than something which I am going to use. If you want to learn good SQL tuning, stick with Guy Harrison - it is more practical.
(Review Data Last Updated: 2007-03-25 07:09:03 EST)
06-13-06 5 3\3
(Hide Review...)  deep and detailed, yet surprisingly easy to follow
Reviewer Permalink
Outstanding and excellent book - and I'm saying this after six months of reading and re-reading, and running and studying the provided scripts, and even performing my own investigations starting from the book's test cases.

It has been surprisingly easy to understand the material, even if I didn't know most of the things discussed. Reading has flown seamlessly, not exactly like reading a novel, but close enough for a technical book about the very complex CBO - and that was something I didn't expect at all, a very very nice surprise.

The most fundamental topics (the first ones are selectivity, cardinality, etc) being right at the beginning, I didn't need to read the whole book to start using the new knowledge effectively in practice, thus getting the "morale boost" that motivated me to read the next chapter, and then the next ... adding layer after layer of knowledge.

I also *loved* the high level of detail, which is absolutely necessary to understand the complex CBO, and the precise and succinct writing style as well, which makes for an easier and quicker learning. When speaking about mathematical subjects (since the CBO is just that of course - a mathematical model), it's mandatory to be precise and detailed: vague statements would only add confusion or, worstly, misunderstanding.

To recap - I've got home a vastly improved understanding of the CBO - and for a fraction of the effort I thought it would have taken.
(Review Data Last Updated: 2007-07-07 20:02:20 EST)
06-12-06 5 3\3
(Hide Review...)  deep and detailed, yet surprisingly easy to follow
Reviewer Permalink
Outstanding and excellent book - and I'm saying this after six months of reading and re-reading, and running and studying the provided scripts, and even performing my own investigations starting from the book's test cases.

It has been surprisingly easy to understand the material, even if I didn't know most of the things discussed. Reading has flown seamlessly, not exactly like reading a novel, but close enough for a technical book about the very complex CBO - and that was something I didn't expect at all, a very very nice surprise.

The most fundamental topics (the first ones are selectivity, cardinality, etc) being right at the beginning, I didn't need to read the whole book to start using the new knowledge effectively in practice, thus getting the "morale boost" that motivated me to read the next chapter, and then the next ... adding layer after layer of knowledge.

I also *loved* the high level of detail, which is absolutely necessary to understand the complex CBO, and the precise and succinct writing style as well, which makes for an easier and quicker learning. When speaking about mathematical subjects (since the CBO is just that of course - a mathematical model), it's mandatory to be precise and detailed: vague statements would only add confusion or, worstly, misunderstanding.

To recap - I've got home a vastly improved understanding of the CBO - and for a fraction of the effort I thought it would have taken.
(Review Data Last Updated: 2007-03-25 07:09:03 EST)
05-05-06 4 3\5
(Hide Review...)  Got my money's worth the first day
Reviewer Permalink
I just bought this book and already got my money's worth just from the information on transitive closure. I've run into this problem a couple times already and am glad to have a better understanding of it now. Looking forward to reading the rest . . .

(I know my rating is premature considering I've only read a few pages so far - that's why I didn't give it 5 stars, but it's off to a very strong start so I felt that 4 stars was fair at this point. How often do you pick up a new book and learn something valuable that you can apply immediately on day 1? I may raise or lower my rating later if my opinion changes after reading more.)
(Review Data Last Updated: 2007-07-07 20:02:20 EST)
03-21-06 5 3\5
(Hide Review...)  Johathan has done it again!!!
Reviewer Permalink
I have over years collected, bought many oracle books. This book is really a gift, an invaluable tools for us who are in the field and want know the ins and outs of the oracle optimizer. I respect, Jonathan because he has proven many times what he actualy said.
I have watched his skills and tuning method. To put it simply, your style of learning works for me. Thank you Jonathan. I can't wait for the others yet to come( you said this is 1 of 3).
(Review Data Last Updated: 2006-11-17 08:48:09 EST)
03-20-06 5 3\5
(Hide Review...)  CBO Fundamentals
Reviewer Permalink
This is the first book I have read and the only book I know exists that is solely dedicated to the CBO. It is an excellent book. After reading the book it helped me understand how CBO make certain decisions and I learned just how error-prone the CBO is. Your data is not a deck of cards. You will go over many probability equations in the book and I did not take the time to try and understand all of them since it is a part of my brain that I do not user anymore. After hearing Jonathan Lewis speak at Hotsos (March 2006) he mentioned that "fundamentals" does not trule translate from UK English to US English very well. This is an advanced topic and the term "fundamentals" does not mean it is a beginner book. I look forward to the 2nd and 3rd book in this series as I will absolutely read them.
(Review Data Last Updated: 2006-11-17 08:48:09 EST)
03-17-06 5 2\3
(Hide Review...)  Common pitfalls and how to avoid them
Reviewer Permalink
Jonathan Lewis' COST-BASED ORACLE FUNDAMENTALS is for any Oracle programmer frustrated by indexing. Optimizers often do something other than intended, even with the best execution plan in place: when this happens, the cost-based optimizer can prove most frustrating. This is first in a projected three-part series to describe commonly used parts of the model, what the optimizer does with statistics, and why things go wrong. From selectivity issues an bitmap indexes to histograms and cardinality, COST-BASED ORACLE FUNDAMENTALS reveals the common pitfalls in optimizer usage and how to overcome or avoid them.
(Review Data Last Updated: 2006-08-14 11:06:20 EST)
03-03-06 5 4\7
(Hide Review...)  Mandatory textbook for Oracle professionals
Reviewer Permalink
This is the best Oracle book I have ever read ( I have read almost everything published on the Oracle subject written in the last 15 years ). It is an example of how technical books should be written. Author tells and shows through examples how he came to conclusions and recommendations.
Very didactic. Even seasoned Oracle professionals will find plenty of useful and new information. Best of all, everything is rock solid and proven ( try running provided scripts and you will learn a lot ). Unlike many other texts and books on the market, this is one of the rare fundamentals that you can lean on. This is source of trusted information. You can learn how to set up your test cases, to quickly generate huge volumes of data, how to logically prove hypothesis. You will learn about the latest in CBO ( system statistics etc ), and how to do your own research. Lewis is at least couple of years ahead of the mainstream. This book is so packed with data, principles and methods that it is equivalent to 10 ordinary books on this subject.
Together with Jonathan's Practical Oracle 8i ( still very relevant ) and his web site, his texts are in a class of its own.
Very rewarding. Most recommended.
(Review Data Last Updated: 2006-07-07 11:07:48 EST)
03-01-06 5 7\8
(Hide Review...)  What's it all about ?
Reviewer Permalink
Since I am the author of this book my opinion is, of course, biased. So far, Amazon.com has seen several rave reviews and a couple of poor ones. I think the critical difference between the reviews lies in one important word:

Understanding.

The purpose of the book is to show you how the cost based optimizer works. I did not write it to give you a list of quick tips that might fix a problem statement (or might make it, and dozens of others, worse). Do not buy this book if all you are after is hints and tips that you can use without thinking. If there were a few quick tricks that could fix everyone's systems, they would already be built into the optimizer code. (And the ones that can't be in the code are in the manuals)

Many people find it easier to understand a process by working through examples so that is the approach I've taken for the book; but this means that some people will find that it just doesn't suit the way they like to think. So rather than depending on reviews, you can download a sample chapter from Apress at the URL: [...] and see for yourself if the approach works for you.

You can also find a list of errors and updates at the URL: http://www.jlcomp.demon.co.uk/cbo_book/ind_book.html#addenda

(Review Data Last Updated: 2006-07-07 11:07:48 EST)
03-01-06 5 1\1
(Hide Review...)  What's it all about ?
Reviewer Permalink
Since I am the author of this book my opinion is, of course, biased. So far, Amazon.com has seen several rave reviews and a couple of poor ones. I think the critical difference between the reviews lies in one important word:

Understanding.

The purpose of the book is to show you how the cost based optimizer works. I did not write it to give you a list of quick tips that might fix a problem statement (or might make it, and dozens of others, worse). Do not buy this book if all you are after is hints and tips that you can use without thinking. If there were a few quick tricks that could fix everyone's systems, they would already be built into the optimizer code. (And the ones that can't be in the code are in the manuals)

Many people find it easier to understand a process by working through examples so that is the approach I've taken for the book; but this means that some people will find that it just doesn't suit the way they like to think. So rather than depending on reviews, you can download a sample chapter from Apress at the URL: [...] and see for yourself if the approach works for you.

You can also find a list of errors and updates at the URL: http://www.jlcomp.demon.co.uk/cbo_book/ind_book.html#addenda

(Review Data Last Updated: 2006-03-07 12:58:35 EST)
02-06-06 2 4\7
(Hide Review...)  No guidelines
Reviewer Permalink
I disagree with Mr. Kyte about this book helping one to understand Oracle and I found the exact opposite.

The book has dozens of examples but no cohesion and no conclusions. If I cut out all of the supercilious code listings that make up over 3/4ths of this book there would be very little left, and even less of this was useful to me. Loads of random examples and thoughts, but no summaries, no conclusions, and no guidelines for the reader.

I really wanted to like this book after reading all of the glowing reviews, but I now feel that this book was a waste of my money. Normally I would not be so harsh but the almost unbelievable glowing praise for this book is out of line with its real quality and I wonder about this mutual admiration society that posts these reviews that influences us customers.
(Review Data Last Updated: 2006-03-03 16:25:31 EST)
02-06-06 2 8\13
(Hide Review...)  No guidelines
Reviewer Permalink
I disagree with Mr. Kyte about this book helping one to understand Oracle and I found the exact opposite.

The book has dozens of examples but no cohesion and no conclusions. If I cut out all of the supercilious code listings that make up over 3/4ths of this book there would be very little left, and even less of this was useful to me. Loads of random examples and thoughts, but no summaries, no conclusions, and no guidelines for the reader.

I really wanted to like this book after reading all of the glowing reviews, but I now feel that this book was a waste of my money. Normally I would not be so harsh but the almost unbelievable glowing praise for this book is out of line with its real quality and I wonder about this mutual admiration society that posts these reviews that influences us customers.
(Review Data Last Updated: 2006-07-07 11:07:48 EST)
01-18-06 3 3\8
(Hide Review...)  Fundamentals?
Reviewer Permalink
First off, I have the utmost respect for Johnathan Lewis' expertise with Oracle. I loved his 8i book.

I would have left the word "Fundamentals" out of the title. It's clearly a book for intermediate to advanced study of CBO albeit a little out of date.

The major complaint I have is that Johnathan spends to much time detailing how he determined how the CBO is functioning and not enough time with:

1.) Articulating what the CBO is doing.
2.) And probably most important, what does this mean to a Developer or DBA who is using CBO in general situations (e.g. OLTP, Data Warehousing, queries, DML, star transformations, partitions etc?
3.) How could we affect CBO in a positive manner in a given situation.

These important subjects are far too frequently either not addressed, or not sufficiently addressed and buried in the gory mathematical details of how he figured out what CBO was doing.

It's almost like he is proving his theories, which is fine if you have the time to work thru them.

I don't really care how he figured it out. I trust that he has tested his theories. Perhaps he could just footnote them on a website.

I did like the way communicated Oracle feature implementation process. And some of the other insider details he derives from his analysis.

Again, his understanding of the product is second to none. His ability to communicate it in English leaves something to be desired - at least this time.
(Review Data Last Updated: 2006-03-03 16:25:31 EST)
01-18-06 3 12\20
(Hide Review...)  Fundamentals?
Reviewer Permalink
First off, I have the utmost respect for Johnathan Lewis' expertise with Oracle. I loved his 8i book.

I would have left the word "Fundamentals" out of the title. It's clearly a book for intermediate to advanced study of CBO albeit a little out of date.

The major complaint I have is that Johnathan spends to much time detailing how he determined how the CBO is functioning and not enough time with:

1.) Articulating what the CBO is doing.
2.) And probably most important, what does this mean to a Developer or DBA who is using CBO in general situations (e.g. OLTP, Data Warehousing, queries, DML, star transformations, partitions etc?
3.) How could we affect CBO in a positive manner in a given situation.

These important subjects are far too frequently either not addressed, or not sufficiently addressed and buried in the gory mathematical details of how he figured out what CBO was doing.

It's almost like he is proving his theories, which is fine if you have the time to work thru them.

I don't really care how he figured it out. I trust that he has tested his theories. Perhaps he could just footnote them on a website.

I did like the way communicated Oracle feature implementation process. And some of the other insider details he derives from his analysis.

Again, his understanding of the product is second to none. His ability to communicate it in English leaves something to be desired - at least this time.
(Review Data Last Updated: 2006-07-07 11:07:48 EST)
12-28-05 5 8\10
(Hide Review...)  The Real Cost of Oracle
Reviewer Permalink
The beauty of reading a book by a publisher not sanctioned by Oracle and by an author who doesn't work for Oracle is that they can openly mention bugs. And there are oh-so-many! This book is a superb introduction to the Cost Based Optimizer, and is not afraid to discuss it's many shortcomings. In so doing it also explains how to patch up those shortcomings by giving the CBO more information, either by creating a histogram here and there, or by using the DBMS_STATS package to insert your own statistics in those specific cases where you need to.

Another interesting thing is how this book illustrates, though
accidentally, the challenges of proprietary software systems. Much of this book and the authors time is spent reverse engineering the CBO, Oracle's bread and butter optimizing engine. Source code, and details about its inner workings are not published or available. And of course that's intentional. But what's clear page after page in this book is that for the DBA and system tuner, going about their day to day tasks, they really need inside information about what the optimizer is doing, and so this book goes on a long journal to illuminate much of what the CBO is doing, or in some cases provide very educated guesses and some speculation. In contrast, as we know and hear about often, the Open Source alternative provides free access to source code, though not necessarily to the goods themselves. What this means in a very real way is that a book like this would not need to be written for an alternative open source application, because the internal code would be a proverbial open book. That said it remains difficult to imagine how a company like Oracle might persue a more open strategy given that their bread and butter really is the secrets hidden inside their Cost Based Optimizing engine. At any rate, let's get back to Jonathan's book.

Reading this book was like reading a scientists notebook. I found it:
o of inestimable value, but sometimes difficult to sift through
o very anecdotal in nature, debugging, and constantly demonstrating that the CBO is much more faulty and prone to errors than you might imagine
o may not be easy to say I have a query of type X, and it is behaving funny, how do I lookup information on this?
o his discussion of the evolution of the product is so good I'll quote it:
"A common evolutionary path in the optimizer code seems to be the following: hidden by undocumented parameter and disabled in first release; silently enabled but not costed in second release; enabled and costed in third release."
o has excellent chapter summaries which were particularly good for sifting, and boiling down the previous pages into a few conclusions.
o it will probably be of particular value to Oracle's own CBO development teams

Some chapter highlights
-------------------

CH2 - Tablescans
explains how to gather system stats, how to use dbms_stats to set ind. stats manually, bind variables can make the CBO blind, bind variable peeking may not help, partition exchange may break global stats for table, use CPU costing when possible

CH3 - Selectivity
big problem with IN lists in 8i, fixed in 9i/10g, but still prob. with NOT IN, uses very good example of astrological signs overlapping birth months, and associated CBO cardinality problems, reminds us that the optimizer isn't actually intelligent per se, but merely a piece of software

CH4 BTree Access
cost based on depth, #leaf blocks, and clustering factor, try to use CPU costing (system statistics)

CH5 - Clustering Factor
mainly a measure of the degree of random distribution of your data, very important for costing indx scans, use dbms_stats to correct when necessary, just giving CBO better information, freelists (procID problem) + freelist groups discussion with RAC

CH6 - Selectivity Issues
there is a big problem with string selectivity, Oracle uses only first seven characters, will be even more trouble for urls all starting with "http://", and multibyte charactersets, trouble when you have db ind. apps which use string for date, use histrograms when you have problems, can use the tuning advisor for "offline optimization", Oracle uses transitive closure to transform queries to more easily opt versions, moves predicates around, sometimes runs astray

CH7 - Histograms
height balanced > 255 buckets (outside Oracle called equi-depth),
otherwise frequency histograms, don't use cursor sharing as it forces bind variables, blinds CBO, bind var peeking is only first call, Oracle doesn't use histograms much, expensive to create, use sparingly, dist queries don't pull hist from remote site, don't work well with joins, no impact if you're using bind vars, if using dbms_stats to hack certain stats be careful of rare codepaths

CH8 - Bitmap Indexes
don't stop at just one, avoid updates like the plague as can cause deadlocking, opt assumes 80% data tightly packed, 20% widely scattered

CH9 - Query Transformation
partly rule based, peeling the onion w views to understand complex queries, natural language queries often not the most efficient, therefore this transformation process has huge potential upside for Oracle in overall optimization of app code behind the scenes by db engine, always remember Oracle may rewrite your query, sometimes want to block with hints, tell CBO about uniqueness, not NULL if you know this

CH10 - Join Cardinality
makes sensible guess at best first table, continues from there,
don't hide useful information from the CBO, histograms may help with some difficult queries

CH11 - Nested Loops
fairly straightforward costing based on cardinality of each returned set multiplied together

CH12 - Hash Joins
Oracle executes as optimal (all in memory), onepass (doesn't quite fit so dumped to disk for one pass) and multipass (least attractive sort to disk), avoid scripts writing scripts in prod, best option is to use workarea_size_policy=AUTO, set pga_aggregate_target & use CPU costing

CH 13 - Sorting + Merge Joins
also uses optimal, onepass, & multipass algorithms, need more than 4x dataset size for in memory sort, 8x on 64bit system, increasing sort_area_size will incr. CPU util so on CPU bottlenecked machines sorting to disk (onepass) may improve performance, must always use ORDER BY to guarentee sorted output, Oracle may not need to sort behind the scenes, Oracle very good at avoiding sorts, again try to use workarea_size_policy=AUTO

CH 14 - 10053 Trace
reviews various ways to enable, detailed rundown of trace with comments inline, and highlights; even mentions a VOL 2 + 3 of the book is coming!

Appendix A
be careful when switching from analyze to dbms_stats, in 10g some new hist will appear w/default dbms_stats options, 10g creates job to gather stats

Conclusion
----------
I found this book to be full of gems of information that you won't find anywhere else. If you're at the more technical end of the spectrum, this is a one of a kind Oracle book and a
must-have for your collection. Keep in mind something Jonathan mentions in appendix A: "New features that improve 99% of all known queries may cripple your database because you fall into the remaining 1% of special cases". If these cases are your concern, then this book will surely prove to be one-of-a-kind for you!
(Review Data Last Updated: 2006-07-07 11:07:48 EST)
12-02-05 5 6\8
(Hide Review...)  No Competition
Reviewer Permalink
There is little point to write how good this book is, since there is no other book devoted to SQL optimization exclusively. Dan Tow's book comes close, but he is focused more on a method of join graph analysis that he developed, than on details how optimizer did arrive to a certain access path. The lack of competition on the market is really surprising giving that SQL optimization is the only part of RDBMS that is justifiably complex, and would remain complex in foreseable future.

Compared to SQL optimizations all the other issues that DBA deals today look ridiculous. There is no reason why, for example export and import should be more complex than copying image file from your camera. Likewise, managing extents and segments is totally automated these days. All the manageability trend just proves a simple idea that RDBMS is nothing more than query execution engine.

Now, unlike any other RDBMS implementation area, the flow of poorly executed SQL never seems to cease. SQL Optimization is well known to be a difficult problem. Statistics information is incomplete, robust cost metrics is elusive, and the search space is explosive. The optimization goals are often conflicting. The very first idea that every SQL performance analyst discovers: "The optimization is only as good as its cost estimates". Those issues are fundamental rather than SQL DBMS vendor specific, of course. Given the scope and complexity of the problem, one citation comes to mind: "There is no emperor's way to SQL optimization".
(Review Data Last Updated: 2006-06-11 12:34:23 EST)
11-24-05 5 6\10
(Hide Review...)  Answering the question "why?"
Reviewer Permalink
Ah, yes, the question: "Why isn't Oracle using my index?"

Have you ever asked it? Well, maybe you've never asked it, but you might have heard about someone who has... If you would like to know how to find the answer, this is the book (well, the first of three, really).

It is important to understand that the book gives you the knowledge needed to find the answer -- it doesn't try to give you a list quick-fixes or "the" answer (which of course it really couldn't). There is no "_optimizer_always_makes_correct_choice = true" hidden parameter you can set, but you can learn how to give the optimizer the best information possible. Plus you'll learn what the optimizer does with this information.

Jonathan's work is always top-drawer and this is no exception. The technical reviewers (Wolfgang Breitling and Christian Antognini) are both well-versed in the workings of Oracle in general and the optimizer in particular. I've no doubt that this helped contribute to the quality of the work. After reading this book you can't help but be more informed and possess the skills necessary to decipher why the optimizer is making the choices that it does.
(Review Data Last Updated: 2006-05-04 11:04:54 EST)
11-22-05 5 7\8
(Hide Review...)  look under the bonnet of Oracle's implementation
Reviewer Permalink
Lewis has produced a book for a rather exclusive audience. Certainly, it's restricted to those of you who use Oracle's databases. But it is further constrained to people who want to seriously understand and optimise their Oracle computations.

Why you want to do this can vary. You might simply be interested, intellectually, in probing into how Oracle implements your SQL operations. Since SQL is a declarative language, most implementations are somewhat of a black box as to how they optimise. Or, your database needs may be so large that you have to carefully tweak for faster runs.

In reply, Lewis delves deeply into how to use the optimiser. Offering detailed looks under the bonnet. By explaining how to see the possible ways that the optimiser might rewrite your query, and what the implications of this are for runtime efficiency. Most books on other databases never take you this far.

Ample opportunity here to heavily improve your table design and your SELECT queries against the tables. Though perhaps you should already be well versed in 9i or 10g to get the most benefit.

The book is also an interesting glance at a way that Oracle is attempting to differentiate itself from competitors. Certainly, for the free databases of MySQL and PostgreSQL, I don't think they have anything remotely comparable to the sophistication of Oracle's optimiser. No doubt Oracle's pitch is that while their license fees are not cheap, you might ultimately derive the most productivity from a knowledgeable use of both their database and optimiser.
(Review Data Last Updated: 2006-03-19 10:09:00 EST)
11-13-05 5 4\6
(Hide Review...)  Oops ! Jonathan did it again!
Reviewer Permalink

Oracle Query Optimizer (Also known as Cost Based Optimizer) is one of the complex topics in the Oracle server. It is often misunderstood as there is no definitive text available on the subject. Jonathan makes the CBO arithmetics easily understandable with his reproduce able test cases and proven examples. This is the first ever book in SQL tuning which tells what/where to look when the query is not choosing right access path or right index and what has to be done to fix that.

Very few people knows about the internal workings of the Oracle Optimizer and Jonathan is the pioneer in that. This book takes you all the way to the optimizer's path in arriving its plan from the statistics and assumptions. This book is packed with most valuable and most sought information for the years by the Oracle DBAs and Developers.

This reminds me one of my consulting assignments with one of the biggest banking customer. When the CIO was complaining that oracle software is very expensive and he pays so much dollars. I had explained him briefly about the workings of the optimizer starting from table access paths to sorting, and permutations and combinations used by Cost based optimizer before arriving to an optimal plan. At the end he finised the conversation with one sentence "Every dollar we pay for oracle is really worth". I guess everyone will have the same feeling if they read and understand the topics explained in this book. You will certainly appreciate the extra ordinary intelligence built in to the oracle query optimzier!

In short, Oracle optimizer is the brain of the Oracle RDBMS and Jonathan is the ace neuro surgeon! I highly recommend to all developers and DBAs who are responsible for database performance and query optimization.

(Review Data Last Updated: 2006-03-01 14:27:36 EST)
  
                  Reader Reviews 1 - 28 of 28                 
  
  
  
  
  
  

Because the data used to generate this site come from outside sources, VeryWellSaid.com cannot guarantee the completeness or accuracy of the data.
Search VeryWellSaid™
Google
Web VeryWellSaid™
New subjects are added every week.
View Subjects Below by:
* Top Selling
 (click category name, left)
* Top-Rated Top Sellers
 (click 'Top Rated', right)
In the news...  
Dubai\UAE Top Rated
Influenza\Bird Flu Top Rated
Iraq Top Rated
Supreme Court Top Rated
All Books Top Rated
Arts Top Rated
Photography Top Rated
Digital Photography Top Rated
Digital Cameras Top Rated
Biography Top Rated
Business Top Rated
Management Top Rated
Marketing Top Rated
Sales Top Rated
Stocks Top Rated
Bonds Top Rated
Real Estate Top Rated
Trading Top Rated
Commodities Trading Top Rated
Time Management Top Rated
Starting A Business Top Rated
Children's Top Rated
Comics Top Rated
Computers Top Rated
PC Top Rated
Mac Top Rated
Programming Top Rated
Design Patterns Top Rated
.Net Top Rated
C# Top Rated
Vb.Net Top Rated
Asp.Net Top Rated
Java Top Rated
Python Top Rated
PHP Top Rated
Perl Top Rated
Javascript Top Rated
Ajax Top Rated
CSS Top Rated
Open Source Top Rated
SQL Top Rated
Databases Top Rated
Oracle Top Rated
MySql Top Rated
Sql Server Top Rated
IIS Top Rated
Apache Top Rated
Linux Top Rated
Windows Server Top Rated
Project Management Top Rated
HTML Top Rated
UML Top Rated
IT Certifications Top Rated
Cisco Certifications Top Rated
MCSE Top Rated
MCSD Top Rated
Cooking Top Rated
Italian Cooking Top Rated
Vegetarian Cooking Top Rated
Wine Top Rated
Engineering Top Rated
Entertainment Top Rated
Health Top Rated
Nutrition Top Rated
Dieting Top Rated
Sex Top Rated
History Top Rated
Military History Top Rated
British History Top Rated
Middle East History Top Rated
Land Battles Top Rated
Naval Warfare Top Rated
Air Warfare Top Rated
9/11 Top Rated
Terrorism Top Rated
Home Top Rated
Mortgage\Home Equity Loan Top Rated
Cars Top Rated
Car Buying Top Rated
Sports Cars Top Rated
Cat Top Rated
Humor Top Rated
Horror Top Rated
Law Top Rated
IP Law Top Rated
Legal History Top Rated
Fiction Top Rated
Oprah's Book Club Top Rated
Medicine Top Rated
Cancer Top Rated
Stroke Top Rated
Heart Disease Top Rated
Fertility Top Rated
Diabetes Top Rated
Pharmacology Top Rated
Back Problems Top Rated
Menopause Top Rated
Thyroid Top Rated
Pain Top Rated
Organic Chemistry Top Rated
Immune System Top Rated
Mystery Top Rated
Nonfiction Top Rated
Outdoors Top Rated
Running Top Rated
Radio Control Models Top Rated
Guns Top Rated
Parenting Top Rated
Divorce Top Rated
Professional Top Rated
Reference Top Rated
Religion Top Rated
Romance Top Rated
Science Top Rated
Physics Top Rated
Chemistry Top Rated
Astronomy Top Rated
Psychology Top Rated
Science Fiction Top Rated
Sports Top Rated
Teens Top Rated
Travel Top Rated
USA Top Rated
Europe Top Rated
France Top Rated
Italy Top Rated
England Top Rated
China Top Rated
All Books Arts Biography Click Here For An A-Z Index Of All 213 Best-Seller Subjects Business Children's Comics
Computers Cooking Engineering Entertainment Health History Home Horror Humor Law Fiction Medicine Mystery
Nonfiction Outdoors Parenting Professional Reference Religion Romance Science Sci-Fi Sports Teens Travel
In Association with Amazon.com

Cache miss
(not cached)