caohong286 发表于 2013-1-29 15:19:43

《Pro Oracle SQL》 Chapter2--2.1 Oracle Architecture Basics

Chapter 2 SQL Execution     SQL的执行
Karen Morton   (page51)
    You likely learned the mechanics of writing basic SQL in a relatively short period of time. Over the course of a few weeks or few months, you became comfortable with the general statement structure and syntax, how to filter, how to join tables, and how to group and order data. But, how far beyond that initial level of proficiency have you traveled?  Writing complex SQL that executes efficiently is a skill that requires you to move beyond the basics.  Just because your SQL gets the job done doesn't mean it does the job well.
    你可能在相当短的时间内掌握写基本SQL的方法。经过几周或几月,你就对一般语句的结构和语法变的很自如,如何使用过滤器,如何连接表,以及如何分组和排序。但是,相比初级的熟练你走出了多远?写执行效率高的复杂SQL是一项技能,需要你在基本水平之上走的更远。就好比你的SQL能完成工作但不意味着它能把工作做好。
    In this chapter, I’m going to raise the hood and look at how SQL executes from the inside-out.  I’ll
discuss basic Oracle architecture and introduce the cost-based query optimizer.  You’ll learn how and
why the way you formulate your SQL statements affects the optimizer's ability to produce the most
efficient execution plan possible.  You may already know what to do, but understanding how SQL
execution works will help you help Oracle accomplish the results you need in less time and with fewer
resources required.   
    在本章,我将揭开"面罩",从里向外探询SQL如何执行。我将讨论基础的Oracle架构和介绍基于成本的查询优化器。你将学会如何和为什么你书写SQL语句的方式将影响优化器,尽可能生成最有效执行计划的能力。你可能已经知道该做什么,但是理解SQL如何执行计划将有助于你帮助Oracle用更少的时间和资源完成你需要的结果。
Oracle Architecture Basics     Oralce 架构基础
    The SQL language is seemingly easy enough that you can learn to write simple SQL statements in fairly
short order.  But, just because you can write SQL statements that are functionally correct (i.e. produce
the proper result set), that doesn’t mean you’ve accomplished the task in the most effective and efficient
way.  
    SQL语言似乎非常容易,你可以在短期内写出简单的SQL语句。但是,仅仅因为你能写出功能正确的SQL(例如:生成适当的结果集),并不意味着你用最有效和快捷的方式完成了任务。
    Moving beyond basic skills requires a deeper understanding of that skill.  For instance, when I
learned to drive, my father taught me the basics.  We walked around the car and discussed the parts of
the car that he thought were important to be aware of as the driver of the vehicle.  We talked about the
type of gas I should put in the car, the proper air pressure the tires should have, and the importance of
getting regular oil changes.  Being aware of these things would help make sure the vehicle would be in
good condition when I wanted to drive it.  
    超越菜鸟级别需要深入理解其中的技术。例如,当初我学开车,我的父亲教授了我基础驾驶的相关知识。我们围绕车转了一圈,然后讨论他认为驾驶汽车必须知道的车的各个部分。我们谈论关于我应该给汽车加什么样的汽油,轮胎的压力,以及多久换一次机油。知道这些有助于让我判断:当驾驶的时候,车是不是在良好状态。
    He then taught me the mechanics of driving.  I learned how to start the engine, shift gears, increase
and decrease my speed, use the brake, use turn signals, and so on.  But, what he didn’t teach me was
specifically how the engine worked, how to change the oil myself, or anything else other than what I
needed to do to allow me to safely drive the vehicle from place to place.  If I needed for my car to do
anything outside of what I learned, I’d have to take it to a professional mechanic.
    他接着教我驾驶操作。我学习怎么发动引擎,换挡,增速,减速,使用刹车,换信号灯,等等。但是,他没有专门教我引擎是如何工作的,我怎么换机油,以及关于我要安全的从一处开另一处需要做什么。如果我要让我的车做任何所学以外的事,我只能去请教专门的(汽车)技工了。
    This isn’t a bad thing.  Not everyone needs to have the skills and knowledge of a professional
mechanic just to drive a car.  But the analogy applies to anyone who writes SQL.  You can learn the
basics and be able to get your applications from place to place.  But, without extending your knowledge,
I don’t believe you’ll ever be more than an everyday driver.  To really get the most out of SQL, you need
to understand how it does what it does.  That means you need to understand the basics of the underlying architecture on which the SQL you write will execute. 
页: [1]
查看完整版本: 《Pro Oracle SQL》 Chapter2--2.1 Oracle Architecture Basics