Understanding SQL

Let’s take a look at the process by which Oracle parses and optimizes SQL. Take the following simple SQL statement:

update         t1 set                  small_no = small_no + 0.1 where         id = 3 and     small_no = 1 ;

How much work does Oracle have to do to understand what this statement means, and to work out the best way to run it? Strictly speaking, the first part of the question is about parsing, and the second is about optimizing; unfortunately many people tend to combine the two operations under the single title of “parsing.”

Parsing

The first step, of course, is for Oracle to decide if the text looks like a valid SQL statement—this step is known as syntactic analysis; if it does look like a valid statement, ...

Get Oracle Core: Essential Internals for DBAs and Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.