Friday 30 October 2009

Jonathan Lewis Seminar in Dallas

I got to hear Oracle performance guru Jonathan Lewis today in an all-day seminar in Dallas. "Writing Optimal SQL" was part 2 of a two-part series here in Dallas, sponsored by Dallas Oracle Users Group (DOUG).


Jonathan started out by reviewing some general principles, such as the importance of design and optimizing for the global situation (many queries) not just a single query. "Making me go fast might make you go slower," he said.


Performance comes from precision in selecting just the blocks and rows you need to select, and from the structure of the data (where it's located).


My favorite part of the seminar was his discussion on coding style for SQL, a topic that is often ignored in performance discussions. His view that "Computers are cheap; humans are expensive" is one that I've been preaching for years in my SQL and PL/SQL classes.  "You have two audiences," I tell my classes, "the compiler, and the poor person who comes after you to maintain your code.  Be kind.  Someday that person will be you." Jonathan's take is that you should write SQL as a close translation of the business purpose of the query, and only fiddle with it if performance isn't acceptable.


He also suggested: "Don't tune the SQL; tune the end users," meaning that if a requirement is unclear or the data creates unexpected results, go back to the person requesting the report and get clarification instead of burning a lot of time over-engineering the solution to fit every possible case.


This talk could easily have been titled, "Unintended Side-Effects of SQL" because Jonathan went through many scenarios in which results differed from what might have been expected, and why it turned out that way.


It was a great session.  Thanks to Speak-Tech  and to DOUG's Mary Elizabeth McNeely, president and programs chair, for bringing Jonathan Lewis to town.



Monday 12 October 2009

Oracle 11gR2 Podcast by Tom Kyte

Tom Kyte recorded a podcast this month about the new features of Oracle Database 11gR2. The podcast, part of the Oracle Database podcasts series, can be accessed here:


http://www.oracle.com/database/podcasts.html


In it, he describes an exciting new feature: the ability to compile stored procedures, packages, etc. while users are online using the same schema! The feature, called Edition-based Redefinition, refers to the current objects as an "edition".  The developer creates a child edition based upon the current one, then does development against the child edition. When it comes time to switch over, new sessions can begin using the new edition, as existing sessions continue to use the old. An upgrade that used to take an hour of downtime for compilations can appear to users to take no time at all. It still takes an hour to compile, he said, but the users are not locked out of the system while it's happening.


He also talks about the ability to create a table, but defer to allocation of storage until the table is first used. This will make it much faster to install complex software applications that have many optional tables in them. Only the metadata in the data dictionary will be created during the install, and tables never used will therfore not take up space.


It's a short talk, about 10 minutes, but well worth listening to.