Skip to Content
Refactoring SQL Applications
book

Refactoring SQL Applications

by Stephane Faroult, Pascal L'Hermite
August 2008
Intermediate to advanced content levelIntermediate to advanced
298 pages
9h 22m
English
O'Reilly Media, Inc.
Content preview from Refactoring SQL Applications

Chapter 6. Task Refactoring

No, it isn’t strange, after changes upon changes, we are more or less the same.

After changes we are more or less the same..

—Paul Simon (b. 1941)

The Boxer

REWRITING QUERIES IS OFTEN CONSIDERED TO BE THE ULTIMATE WAY TO IMPROVE A PROGRAM THAT accesses a database. Even so, it is neither the most interesting nor the most efficient way to refactor a program. You will certainly encounter from time to time a query that severe editing will speed up beyond recognition. But increasingly, as optimizers become more sophisticated and as statistics collection becomes more automated and more accurate, query tuning grows into the kind of skill you exhibit on social occasions to show that you have other qualities besides being a handsome, witty, and cultivated individual.

In real life, the tuning of single SQL statements is no longer as vital as it used to be. What is increasingly important isn’t to master the SQL skills that allow you to improve existing statements, but rather to master those that allow you to perform in very few data accesses what somebody less enlightened could write in only a convoluted procedural fashion. Indeed, both skill sets are very close in spirit; as you saw in Chapter 5, efficiently rewriting a statement is about hitting the tables fewer times, and so is efficiently designing an SQL application. But you must take a high-level view and consider not only what you feed into a query and what it returns, but also where the filtering criteria are ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

RESTful Java Web Services - Third Edition

RESTful Java Web Services - Third Edition

Balachandar Bogunuva Mohanram
Modernizing Enterprise Java

Modernizing Enterprise Java

Markus Eisele, Natale Vinto
Ultra-Fast ASP.NET 4.5

Ultra-Fast ASP.NET 4.5

Richard Kiessig

Publisher Resources

ISBN: 9780596514976Supplemental ContentErrata Page