Fully automated SQL tuning

Fully automated SQL tuning
USOO8903801B2
(12) United States Patent
(10) Patent N0.:
Belknap et al.
(54)
(45) Date of Patent:
FULLY AUTOMATED SQL TUNING
5/1989 Green
9/1990 Shibamiya et a1.
5’287’459 2
A
2/1994 {Zucmga
Grizawnekefta '
5,301,317 A
5,315,580 A
4/1994 Lohman etal.
5/1994 Phaal
5,325,525 A
6/1994 Shan et a1.
5,339,429 A
5,379,424 A
8/1994 Tanaka et al'
1/1995 Morlmoto et al.
5,412,806 A *
5/1995
Subject to any disclaimer, the term of this
patent is extended or adjusted under 35
5,444,820 A
5,452,468 A
8/ 1995 TZeS @131,
9/ 1995 Peterson
U_s_c_ 15403) by 314 days_
5,459,837 A
10/1995 Caccavale
Karl Dias, Foster City, CA (Us);
Khaled Yagoub, Newark, CA (US)
(73) Assignee: Oracle International Corporation,
Redwood Shores CA (Us)
’
Notice:
5,412,804 A
.
Du et a1. ............................. .. 1/1
OTHER PUBLICATIONS
Aug. 8, 2008
_
(65)
5/1995 Knshna
(Continued)
(21) App1.No.: 12/188,975
(22) Filed:
Dec. 2, 2014
4,829,427 A
4,956,774 A
(75) Inventors: Benoit
Peter Belknap,
Dageville,Redwood
Foster City,
City,CA
CA(US);
(US);
(*)
US 8,903,801 B2
_
_
Dageville et al., “Automatic SQL Tuning in Oracle 10g”, In Proceed
Pnor PUbhcatlon Data
US 2009/0077016 A1
Mar. 19, 2009
ings of the Thirtieth International Conference on Very Large Data
bases, vo1~ 30, 2004,19 1098-1109~*
Related U.S. Application Data
(connnued)
(60) Provisional application No. 60/972,681, ?led on Sep.
14, 2007_
Primary Examiner * Phuong Thao Cao
(74) Attorney, Agent, or Firm * Hickman Palermo Truong
(51) Int. Cl.
Becker Bingham Wong LLP
G06F 1 7/30
(2006.01)
(52) U.S. Cl.
CPC
Gan 1 7/30306 (2013.01); 6an 1 7/30442
USPC
_
(58)
(57)
93
"""""
_
’
Fleld of Classl?catlon searCh
'
’
Techniques are provided for a fully-automated process for
'
tuning database query language statements that selects data
_
base query language statements for tuning, tunes the database
CPC .................. .. G06F 17/30306, G06F 17//30442,
YIOS 707 99932
USPC """"" " 707/999'003’ 999'005’ 713’ 1/317'017’
query language statements and generates tuning recommen_
dations, tests the tuning recommendations, and determines
Whether to implement the tuning recommendations based on
_
_
ABSTRACT
_
707 999002
the test results. The fully-automated tuning process may also
see apphcanon ?le for complete searCh hlsmry'
automatically implement certain tuning recommendations
References Cited
and monitor the performance of the database query language
statements for Which tuning recommendations have been
implemented
(56)
U.s. PATENT DOCUMENTS
4,769,772 A
4,803,614 A
9/1988 Dwyer
2/1989 Banba et a1.
30 Claims, 2 Drawing Sheets
1112
IDENTIFVCANDTDATEDATABASE
005m LANGUAGE STATEMENTS
FORTuNTNG
1M
TUNE THE CANDTDATE DATABASE
QUERY LANGUAE STATEMENTS
AND GENERATE TUNTNG
RECOMMENDATIONS
1
TEST THE TUNING
RECUMMENDATTONS AND GATHER
TEST PERFORMANCE DATA
1
10.5
DEI'ERMTNE WHTCH TUNING
REOOMWENDATTONS TO
IMPLEMENT
11.11
INFLEMENT THE TUNING
REGGNMENDATTQNS SELECTED IN
.1011
M2
MONTTOR PERFORMANCE OF
DATABASE QUERY LANGUAGE
STATEMENTS FOR WHIGI TUNTNG
RECOMMENDAT1 0N5 WERE
IAFLEMENTED
J10“
US 8,903,801 B2
Page 2
(56)
References Cited
7,526,508 B2*
4/2009 Tan et a1. ............................ .. 1/1
U_S_ PATENT DQCUMENTS
7,647,293 B2*
7,664,730 B2 *
1/2010 Brown et al.
2/2010 Ziauddin et a1.
707/999.002
707/718
7,747,606 B2*
6/2010 Dageville et al. ........... .. 707/713
5469560 A
5 495 419 A
11/1995 Begun
2/1996 Rostoker et 31,
7,805,411 B2*
7,890,491 B1*
9/2010 Ziauddin et a1. ............ .. 707/688
2/2011 Simmen ..... ..
707/713
5’495’606 A
271996 Borden etal‘
471996 Fegurson et 31‘
7,966,313 B2*
6/2011 Bruno 61211. .
707/713
53504894 A
7,970,755 B2*
6/2011 Belknap 6121. .
707/713
5537588 A
7/1996 Engelmann et al‘
8,019,750 B2*
9/2011 Kosciusko et a1. ..
707/718
5,551,027 A
8/1996 Choyetalt
8,180,762 B2*
5/2012 Steinbach et a1.
707/713
5 572 640 A
11/1996 Schettler
535743900 A
11/1996 Huang etal‘
2001/0047372 A1
11/2001 Goreliketal.
5,590,319 A
5 642 515 A
12/1996 Cohen et 31‘
6/1997 Jones et 31‘
2002/0038313 A1
2002/0099521 A1
3/2002 Klein et a1.
7/2002 Yang et a1.
5,671,403 A
536753791 A
9/1997 Shekita et 31‘
8,386,450 B2*
2002/0138376 A1
2/2013
Simmen ...................... .. 707/705
9/2002 Hinkle
10/1997 Bhide etal‘
2002/0188600 A1
5,680,547 A
10/1997 Chang
2003/0033291 A1
2/2003 Harris
5694 591 A
537103915 A
12/1997 Du et al‘
1/1998 McElhiney
2003/0065644 A1
2003/0088541 A1*
4/2003 Horman et a1.
5/2003 Zilio et a1. ...................... .. 707/1
5,761,654 A *
6/1998
5764912 A
6/1998 Rosborough
TOW “““““““““““““““““““““ N 1/1
12/2002 Lindsayet a1.
2003/0093408 A1*
5/2003
2003/0115212 A1
6/2003 Hornibrooket al.
Brown et a1.
................... .. 707/2
7/2003 VanArsdale et a1.
5765150 A
6/1998 Burrows
2003/0135480 A1
537873251 A
7/1998 Hamiltonetal'
2003/0159136 A1
8/2003 Huangetal.
5794 227 A
8/1998 Brown
2003/0182276 A1
9/2003 Bossman et a1.
8/1998 Boyer et 31‘
2003/0212647 A1
537973136 A
5 822 748 A
5’852’820 A
538573180 A
5,860,069 A
10/1998 Cohen et 31‘
1271998 Burrows
171999 Hallmark et 31,
1/1999 Wright
11/2003 Bangelet a1.
2003/0212668 A1
11/2003 Hinshaw et a1.
2003/0229639 A1* 12/2003 Carlson 6121. ..
707/100
2004/0003004 A1*
1/2004 (3116116111611 6121. ......... .. 707/200
2004/0015600 A1
1/2004 Tiwaryetal.
5,875,445 A
5 918 225 A
630021669 A >1
2/1999 Antonshenkov
6/1999 White et 31,
1271999 White ,,,,,,,,,,,,,,,,,,,,,,,,, H 370/235
2004/0181521 A1
2004/0205062 A1*
2004/0220911 A1
9/2004 Simmen .......................... .. 707/3
10/2004 Brown et a1. ................... .. 707/3
11/2004 2622116 6121.
6,003,022 A
6,009,265 A
12/1999 Eberhard et 31‘
12/1999 Huang etal‘
2/2000 ROSS et al‘
2004/0244031 A1
2005/0028134 A1
12/2004 MaItineZ
2/2005 Zane etal.
3/2005 Ferrat et a1.
6026 390 A
61026391 A
6026 394 A
272000 Osborn etal,
2/2000 Tsuchida et 31‘
2005/0055382 A1
2005/0086195 A1*
2005/0120000 A1*
4/2005 Tan 6161. ........................ .. 707/1
6/2005 Ziauddin et al.
. 707/3
6’061’676 A
572000 Srivastava et 31‘
2005/0125393 A1*
6/2005 Yagoub 6121. ..
707/3
6’205’451 B1
632893335 B1
372001 Norcott et 31‘
972001 Downing etal‘
2005/0125427 A1*
2005/0125452 A1*
6/2005 Dageville 61211.
6/2005 Ziauddin 6121.
707/100
. 707/104.1
6298 342 B1
10/2001 Graefe et al‘
2005/0138015 A1*
6/2005 Dageville et a1.
6’334’128 B1
1272001 Norcott et 31,
2005/0165741 A1*
7/2005
GOIdOIl ......... ..
707/3
. 707/3
633393768 B1
172002 Leung ml,
2005/0177557 A1*
8/2005 Ziauddin 6161. ................ .. 707/3
6,353,826 B1
3/2002 Seputis
2005/0177971 A1
8/2005 POICO
6356 889 B1
3/2002 Lohman et 31,
2005/0187917 A1*
8/2005
613561891 Bl*
6370 524 B1
3/2002 Agnwa1e1a1. ..................... .. 171
4/2002 Witkowski
2005/0187971 A1
2005/0198013 A1
8/2005 Hassan e121.
9/2005 Cunningham et a1.
6’430’550 B1
872002 Leo et 31‘
2005/0203933 A1
9/2005 (311666111611 @1211.
634383558 B1
872002 Stegelmann
2005/0203940 A1
6,438,562 B1
8/2002 Gupta et al‘
2005/0234965 A1
10/2005 Rozenshtein et al.
6526526 131*
6,529,896 B1
2/2003 Dong et 31, ,,,,,,,,,,,,,,,,,,, H 714/46
3/2003 Leung et 31,
2005/0262060 A1
2005/0278357 A1*
11/2005 Rohwedder et a1.
12/2005 Brown et a1. ............... .. 707/100
6 529 901 B1
3/2003 Chaudhuriet al‘
2005/0278577 A1*
12/2005 Doong et a1.
635983038 131*
6,615,222 B2*
772003 Guayet 31, ,,,,,,,,,,,,,,,,,,,,,,,,,, H 171
9/2003 H61ni1n661< 6121. ................ .. 1/1
2005/0283458 A1*
2005/0283471 A1
12/2005 Galindo-Legaria 6121. .... .. 707/1
12/2005 Ahmed
6,684,203 B1
6,694,306 B1
6,807,546 B2
1/2004 Waddington 6121.
2/2004 Nishizawa 6121.
10/2004 Young_Lai
2006/0026115 Al
2006/0026133 A1
2006/0031200 A1
Lawande et a1. ................ .. 707/3
9/2005 17211216161.
.. 714/38
2/2006 Ahmed
2/2006 Ahmed
2/2006 Santosuosso
6,901,405 B1
5/2005 McCrady et 31,
2006/0036989 A1*
2/2006 Chaudhuriet a1. ......... .. 717/101
6934 699 B1
8/2005 Haas et al‘
2006/0041537 A1
2/2006 Ahmed
972005 Srivastava et 31,
6’941’360 B1
2006/0085378 A1*
4/2006 Raizman 6121. ................ .. 707/1
6,954,776 B1
10/2005 Cruanes et al‘
2006/0085484 A1*
4/2006 Raizman et a1.
639613729 B1
11/2005 Toohey et al‘
2006/0101224 A1*
5/2006 Shah et a1. .... ..
6980 988 B1
6,990,503 B1
12/2005 Demers et al‘
1/2006 Luo et al‘
2006/0107141 A1*
2006/0129542 A1*
5/2006 Hekmatpour
6/2006 Hinshaw et a1.
2006/0195416 A1*
2006/0212428 A1*
8/2006 Ewen 61111. ..................... .. 707/2
9/2006 Nelson ............................ .. 707/3
9/2006 Chowdhuri @121.
730073007 132*
7089 225 B2
272006 Slum ,,,,,,,,,,,,,,,,,,,,,,,,,,, n 7077809
8/2006 Liet al‘
711391749 B2*
11/2006 Bossman @131. ............ .. 707/714
2006/0218123 A1
7,155,428 131*
12/2006 Brown et 31, ,,,,,,,,,,,,,,,,,,,,,,, N 1/1
2007/0038595 A1
2/2007 Ghosh et a1.
7,155,459 132*
12/2006
2007/0038618 A1*
2/2007
Chaudhuriet a1, ,,,,,,,,,,,,,,,,, N 1/1
707/200
.. 711/173
714/724
707/3
Kosciusko et a1. .............. .. 707/4
7,185,000 Bl
2/2007 Brown etal,
2007/0061379 A1
3/2007 Wong et a1.
7,194,452 B2*
7,234,112 B1
3/2007 Galindo-Legaria et a1. ........ .. 1/1
6/2007 Brown et al.
2007/0078825 A1*
2007/0083500 A1*
4/2007 Bornhoevd et a1. ............. .. 707/3
4/2007 Zibitsker ........... ..
707/3
7/2007 Ahmed
2007/0136383 A1*
6/2007 Steinbach et al.
2007/0214104 A1*
2008/0010240 A1
9/2007 Miao et al. ...................... .. 707/2
1/2008 Zait
7,246,108 B2
7,305,410 B2
7,337,169 B2*
12/2007 Skopec et al.
2/2008 Galindo-Legaria et al. ........ .. 1/1
707/200
7,383,247 B2
7,406,477 B2
6/2008 Li et al.
7/2008 Farrar et a1.
2008/0040196 A1
2008/0052271 A1
2/2008 Coon et a1.
2/2008 Lam
7,499,907 B2
3/2009 Brown et al.
2008/0077348 A1*
3/2008 Hildebrand et al. ........ .. 702/117
US 8,903,801 B2
Page 3
(56)
Bhide, Anupam, “An Analysis of Three Transaction Processing
Architectures”, Computer Science Division, UC Berkeley, Proceed
ing ofthe 14th VLDB Conference, 1998, pp. 339-350.
Copeland, George et al., “Data Placement in Bubba,” ACM
References Cited
U.S. PATENT DOCUMENTS
2008/0098003 A1 *
4/2008
2008/0114718 A1
5/2008 Anderson et al.
Dias et al. ..................... .. 707/10
2008/0126393 A1 *
5/2008
Bossman et al. ............ .. 707/102
0897912683, 1988, pp. 99-108.
Dayal, Umeshwar, “Of Nests and Trees: A Uni?ed Approach to
Processing Queries That Contain Nested Subqueries, Aggregates and
Quanti?ers”, Proceedings of the 13th VLDB Conference, Brighton
2008/0168058 A1
7/2008 Gordon
2008/0178079 A1 *
2008/0215536 A1 *
7/2008
9/2008
2008/0228710 A1
9/2008 Muras
1987, pp. 197-208.
Dewitt, et al., “A Performance Analysis of the Gamma Database
2008/0235183 A1 *
9/2008
Machine,” Computer Sciences Department, University of Wisconsin,
2009/0006445
2009/0018992
2009/0037923
2009/0077017
1/2009 Shemenzon et al.
1/2009 Zuzarte et al.
2/2009 Smith et al.
A1
A1
A1
A1
Chen et al. .................. .. 715/700
Day et al. ........................ .. 707/2
Draese et al. ................... .. 707/2
3/2009 Belknap et al.
2009/0327214 A1*
12/2009
Richardson et al. ............ .. 707/2
2009/0327254 A1*
12/2009
Bruno et al.
..... ..
..
1988, 33 pages.
Englert, Susan et al., “A Benchmark of NonStop SQL Release 2
Demonstrating Near-Linear Speedup and Scaleup on Large Data
bases”, Technical Report 89.4, Tandem Part No. 27469, May 1989,
32 pages.
Agrawal et al., “Database Tuning Advisor for Microsoft SQL Server
Graefe, Goetz, “Encapsulation of Parallelism in the Volcano Query
Processing System,” Mar. 1990, 14 pages.
Hirano, et al., “Load Balancing Algorithm for Parallel Processing on
Shared Memory Multiprocessor”, IEEE, pp. 210-217, 1991.
Hong, et al., “Optimization of Parallel Query Execution Plans in
2005: Demo”, In Proceedings of the 2005 ACM SIGMOD Interna
tional Conference on Management of Data, 2005, pp. 930-932.*
Agrawal et al., “Automated Selection of Materialized Views and
Indexes for SQL Databases”, In Proceedings of the 26th International
XPRS ”, Proceedings of the First International Conference on Paral
lel and Distributed Information Systems, IEEE, 1991, 8 pages.
Leverenz et al., “Oracle 8i Concepts Release 8.1.5- A67781-01”,
Oracle Corporation, Feb. 1999, located on the internet at <http://
Conference on the Very Large Databases, 2000, 10 pages.*
Oracle® Database Performance Tuning Guide 10g Release 2 (10.2)
“Using Plan Stability” pp. 18-1 to 18-10, 10gR2 released Jul. 11,
www.csee.umbc.edu/help/oracle8/server.815/a6778l/toc.htm>, 122
2005.
Corporation, Oracle White Paper, Feb. 2002, pp. 1-30.
Pirahesh, Hamid, et al., “Extensible/Rule Base Query Rewrite Opti
mization in Starburst”, IBM Almaden Research Center, ACM,
Sigrnod, dated 1992, 10 pages.
2010/0005340 A1*
1/2010 Belknap et al. ............... .. 714/37
OTHER PUBLICATIONS
Gopalkrishnand, Vivikanand, et al. “Issues of Object-Relational
View Design in Data Warehousing Environment,” IEEE 1998,
0780347781, pp. 2732-2737.
pages.
Lumpkin, George et al., “Query Optimization in Oracle 9i”, Oracle
Kung, Chenho, “Object Subclass Hierarchy in SQL: A Simple
Selinger, P. Grif?ths, et al., “Access Path Selection in a Relational
Approach,” Communications ofthe AC, Jul. 1990, vol. 33, No. 7, pp.
Database Management System”, Proceedings of the 1979 ACM
1 17-125.
SIGMOD International Conference on the Management of Data,
1979, pp. 23-34.
Bello, Randall G. et al. “Materialized Views in Oracle,”VLDB ’98,
Proceedings of 24th International Conference on Very Large Data
Najjar, Faiza et al. “Cardinality estimation of distributed join que
Stonebraker, Michael, et al. “The Design of XPRS,” Proceedings of
the 14th VLDB Conference, 1988, 18 pages.
Tandem, “A Benchmark of NonStop SQL on the Debit Credit Trans
action”, The Tandem Performance Group, 1988, 26 pages.
ries,” Sep. 1-3, 1999; Database and Expert Systems Applications,
Borla-Salamet, Pascale, “Compiling Control into Database Queries
Bases, Aug. 24-27, 1998, NewYork City, NewYork, USA, pp. 659
664.
1999, Proceedings, Tenth International Workshop on, pp. 66-70.
for Parallel Execution Management,” IEEE Conference on Parallel
Moro, Gianluca et al. “Incremental maintenance of multi-source
Distributed Information Systems, 1991, ISBN 0-8186-2295-4, pp.
views,” Database Conference, 2001, ADC 2001, Proceedings, 12th
271-279.
Australasian, Jan. 2001, pp. 13-20.
Chaudhuri, Surajit et al., “Including Group-By in Query Optimiza
Ahmed, Ra?, et al., “Cost-Based Query Transformation in Oracle,”
Copyright 2006 VLDB, ACM 1595933859, pp. 1026-1036.
Deutsch, Alin et al., “Minimization and Group-By Detection for
Nested XQueries”, University of California, San Diego, 2003, 15
tion,” Proceedings of the 20th VLDB Conferenceil994, pp. 354
pages.
Dehaan, David, “A Rewriting Algorithm for Multi-Block Aggrega
tion Queries and Views using Prerequisites and Compensations”,
University of Waterloo, Canada, Technical Report CS-2004-25, May
3, 2004, 39 pages.
Chaudhuri, Suraj it, “An Overview of Query Optimization in Rela
tional Systems”, Microsoft Research, 1998, 10 pages.
366.
Galindo-Legaria, Cesar et al., “Outerjoin Simpli?cation and Reor
dering for Query Optimization,” ACM Transactions on Database
Systems, vol. 22, No. 1, Mar. 1997, pp. 43-74.
Erickson, Gail et al., “Improving Performance with SQL Server 2000
Indexed Views,” Microsoft TechNet, Sep. 2000, located on the
internet at http://www.microsoft.com/technet/prodtechnol/sql/2000/
maintain/indewimspx?pf:true, retrieved on Nov. 11, 2006, 10
pages.
Muralikrishna, M., “Improved Unnesting Algorithms for Join Aggre
Mishra, Priti et al., “Join Processing in Relational Databases,” ACM
Computing Surveys, vol. 24, No. 1, Mar. 1992, pp. 63-113.
gate SQL Queries”, VLDB Conference, Canada, 1992, 12 pages.
Hayu, John, “Analytic SQL Features in Oracle9i”, An Oracle Tech
and Implementation,” SIGMOND ’96, 1996 ACM 0-89791-794-4,
nical White Paper, Dec. 2001, 32 pages.
Bergsten, et al., “Prototyping DBS3 a Shared-Memory Parallel Data
base System”, IEEE 818622954, 226-234, 1991, pp. 226-234.
Seshadri, Preveen, “Cost-Based Optimization for Magic: Algebra
pp. 435-446.
* cited by examiner
US. Patent
Dec. 2, 2014
Sheet 1 0f2
US 8,903,801 B2
lQZ
IDENTIFY CANDIDATE DATABASE
QUERY LANGUAGE STATEMENTS
JIOO
FOR TUNING
_'L0_4L
TUNE THE CANDIDATE DATABASE
QUERY LANGUAGE STATEMENTS
AND GENERATE TUNING
RECOMMENDATIONS
1_OS
TEST THE TUNING
RECOMMENDATIONS AND GATHER
TEST PERFORMANCE DATA
19.8
DETERMINE WHICH TUNING
RECOMMENDATIONS TO
IMPLEMENT
M
IMPLEMENT THE TUNING
RECOMMENDATIONS SELECTED IN
1&8
112
MONITOR PERFORMANCE OF
DATABASE QUERY LANGUAGE
STATEMENTS FOR WHICH TUNING
RECOMMENDATIONS WERE
IMPLEMENTED
1
'
US 8,903,801 B2
1
2
FULLY AUTOMATED SQL TUNING
of prior tuning actions. Finally, this tuning process must be
repeated periodically because both workload sets and data
base systems may change overtime.
CROSS-REFERENCE TO RELATED
Thus, there is a need for a fully automated process for
APPLICATIONS; BENEFIT CLAIM
tuning SQL statements that require minimal time and effort
This application claims bene?t of Provisional Appln.
60/972,681, ?led Sep. 14, 2007, the entire contents of which
is hereby incorporated by reference as if fully set forth herein,
under 35 U.S.C. §119(e).
that could be pursued, but not necessarily approaches that
have been previously conceived or pursued. Therefore, unless
FIELD OF THE INVENTION
otherwise indicated, it should not be assumed that any of the
approaches described in this section qualify as prior art
from database administrators.
The approaches described in this section are approaches
merely by virtue of their inclusion in this section.
The present invention relates to the ?eld of electronic data
base management.
BRIEF DESCRIPTION OF THE DRAWINGS
BACKGROUND
The present invention is illustrated by way of example, and
not by way of limitation, in the ?gures of the accompanying
SQL performance is a very critical component of the over
all performance of a database system. Although database
applications are tested and veri?ed before delivery to custom
20
ers, the performance of SQL statements in the database appli
cations is dif?cult to predict. Every time an SQL statement is
executed, a different execution plan may be generated by the
query optimizer. Often, the execution plan is one that has not
been tested before and one whose performance has not been
analyzed and veri?ed. Should the query optimizer choose a
drawings and in which like reference numerals refer to similar
elements and in which:
FIG. 1 is a ?ow diagram that illustrates steps in a fully
automatic process for tuning database query language state
ments.
25
FIG. 2 is a diagram of a computer system that may be used
in an implementation of an embodiment of the present inven
tion.
plan that does not give the best performance, the performance
DETAILED DESCRIPTION
of the system as a whole may suffer.
SQL tuning is a process where the performance of certain
SQL statements is analyzed and changes are implemented in
an effort to improve the performance of the SQL statements.
30
However, SQL tuning is complex and time-consuming,
a thorough understanding of the present invention. It will be
apparent, however, that the present invention may be prac
ticed without these speci?c details. In other instances, well
requiring expertise in query optimization, access design, and
SQL design. Often, this difficult task is performed manually
by the database administrator (DBA), who must also re-tune
In the following description, for the purposes of explana
tion, numerous speci?c details are set forth in order to provide
35
known structures and devices are shown in block diagram
SQL statements as the workload set on the database system
form in order to avoid unnecessarily obscuring the present
and the database system itself change over time.
An SQL Tuning Advisor, as described in “AUTOMATIC
invention.
Overview
SQL TUNINGADVISOR”, application Ser. No. 10/936,778,
?led Sep. 7, 2004, the entire contents of which is hereby
incorporated by reference as if fully set forth herein, provides
the DBA with the functionality of tuning SQL statements by
generating tuning recommendations for the SQL statements.
The SQL Tuning Advisor can, for example, perform access
40
path analysis and recommend creating new indexes, perform
45
statement structure analysis and recommend better written
statements, and perform data statistics analysis and recom
database query language (e.g., SQL) statements:
(1) identify SQL statements that may adversely impact the
performance of the database system;
mend replacing missing or stale data statistics with updated
statistics.
However, using the SQL Tuning Advisor still requires sig
50
(2) tune the identi?ed SQL statements to generate tuning
recommendations for the SQL statements;
(3) test the recommendations and gather data about the
performance of the SQL statements with the tuning rec
55
(4) implement the tuning recommendations that meet cer
tain performance improvement and/ or con?dence crite
ni?cant time, effort, and involvement from DBAs. In order to
use the SQL Tuning Advisor, DBAs are required to ?nd SQL
statements that are exhibiting poor performance as candidates
ommendations incorporated;
for tuning, feed the candidate SQL statements into the SQL
Tuning Advisor, and manually evaluate the results and tuning
recommendations generated by the SQL Tuning Advisor to
decide which tuning recommendations to implement. The
ria; and
(5) monitor the database system after implementation of
SQL tuning process implemented by the SQL Tuning Advisor
the tuning recommendations to measure the perfor
is itself time-consuming and, on a busy system, may need to
be scheduled by the DBA. Furthermore after deciding which
tuning recommendations to implements, DBAs must also
monitor the performance of the database system after imple
mentation of the tuning recommendations to check that per
formance gains have been achieved according to expecta
tions. If the performance has instead deteriorated, DBAs must
then perform further analysis to respond to the problem. To
prepare for such a situation, DBAs also need to keep a record
Although the embodiments of the invention are described
using the term “SQL”, the invention is not limited to just this
particular database query language, and may be used in con
junction with other database query languages and constructs.
A process performs the following steps to provide users of
database systems with a fully-automated process for tuning
60
mance of SQL statements for which tuning recommen
dations have been implemented.
Additionally, the fully-automated tuning process runs in a
controlled environment so that the resource-intensive tuning
steps in the process do not impact other activities on the
65
database system.
Finally, the fully-automated tuning process generates
detailed reports that describe how the SQL statements are
US 8,903,801 B2
3
4
tuned and which tuning recommendations were implemented
quently relative to other statements (e.g., one million times a
and that can be provided to DBAs.
week) over the course of the past week. Thus, tuning the SQL
statements that have high combinations of execution times
Identifying SQL Statements for Tuning
and frequencies of execution will likely improve the overall
performance of the database system.
The second category of SQL statements includes SQL
In the fully-automated tuning process, candidate SQL
statements for tuning are automatically identi?ed. The can
statements that are high-load over any day in the past week.
As just discussed, high-load statements are statements that
have long execution times and that are frequently executed.
didate SQL statements identi?ed for tuning are SQL state
ments that have been determined to impact the performance
of the database system the most and for which the SQL
Tuning Advisor’s built-in algorithms are the most likely to
help. The identi?cation of candidate SQL statements for tun
ing is performed in step 102 of ?ow diagram 100 in FIG. 1.
In step 102, SQL statements are identi?ed from a workload
set, which is a collection of SQL statements and performance
information associated with the SQL statements. According
The ?rst category includes statements that are high-load over
the course of a past week. However, statements that are not
high-load over the entire course of the past week may none
theless signi?cantly affect the performance of the database
system. For example, a particular SQL statement may be
executed only on Mondays. On Mondays, however, this par
ticular SQL statement may be executed very frequently and
to one embodiment, the workload set is stored as a SQL
Tuning Set. SQL Tuning Sets are described in “SQL TUN
ING SETS”, application Ser. No. 10/936,449, ?led on Sep. 7,
2004, the entire contents of which are hereby incorporated by
reference. An SQL Tuning Set is a persistent database object
may have long execution times every time it is executed.
Thus, while this particular statement may not be one of the
20
that stores one or more database query language statements
and performance information for each statement. The perfor
mance information may include, for example, execution mea
surements and execution context of each statement.
highest load statements over the course of an entire week, this
particular statement may nonetheless signi?cantly impact the
25
The SQL statements and associated performance informa
performance of the database system on Mondays. The second
category of high-load SQL statements captures statements
like this particular statement for tuning.
The third category includes SQL statements that are high
load over any hour in the past week. The ?rst and second
tion may come from a source such as an Automatic Workload
categories just discussed capture SQL statements that are
Repository (AWR), which stores the statements executed dur
ing a speci?c period of time and the performance information
high-load over the course of the past week or high-load over
associated with the executed statements. Automatic Work
load Repositories (AWRs) are described in further detail in
“AUTOMATIC WORKLOAD REPOSITORY BATTERY
OF PERFORMANCE STATISTICS”, application Ser. No.
10/ 934,344, ?led on Sep. 3, 2004, the entire contents of which
are hereby incorporated. According to one embodiment, the
AWR collects and stores SQL statements and associated per
the course of a day in the past week, but do not capture SQL
30
only Tuesdays, and only from ten o’clock in the morning to
35
formance information from the past week and at an interval of
one hour. The SQL statements collected by the AWR may
include bind values and other critical components of the
SQL’s compilation environment, such as optimizer param
past week;
signi?cantly impact the performance of the database system
during that one-hour interval. Therefore, tuning this particu
40
category.
45
experiences if it takes a very long time to execute (e.g., thirty
50
minutes). Therefore, tuning statements like this may signi?
cantly improve overall performance. According to one
embodiment, only SQL statements that have been executed at
(4) SQL statements that have a high response time.
The ?rst category of SQL statements includes SQL state
tion time and frequency of execution serves as a good proxy
for measuring how signi?cant an SQL statement is in a work
load set. An SQL statement whose execution time (e.g., one
tenth of a second) is small may nonetheless constitute a large
part of a workload set if the statement is executed very fre
The fourth category includes SQL statements which have
long execution times regardless of their frequencies of execu
tion. An SQL statement that is not frequently executed, and
thus may not be included in the ?rst three categories, may
nonetheless negatively impact the response time one user
(3) SQL statements that are high-load over any hour in the
statement. Since one goal of performance tuning is to
decrease the total amount of time spent in executing a work
load set, the execution times of the SQL statements are key
performance metrics. The cumulative combination of execu
lar SQL statement may signi?cantly improve the overall per
formance of the database system during key time periods.
These types of SQL statements are included in the third
past week; and
ments that are high-load over the past week. These are SQL
statements that have the highest cumulative values of execu
tion statistics, where each statistic represents a total amount
of resources consumed over multiple executions of the SQL
eleven o’clock in the morning. This SQL statement is thus
unlikely to be included in the ?rst two categories. Nonethe
less, if this particular SQL statement has a long execution
time and is frequently executed during the one-hour interval
between ten o’clock and eleven o’clock on Tuesday, it may
eter values. The performance information associated with the
SQL statements and collected by the AWR may include: total
time spent in execution, CPU time, I/O time, the number of
I/Os, and the frequency of execution.
The data collected by the Automatic Workload Repository
(AWR) is analyzed in step 102 to determine which SQL
statements fall within the following four categories:
(1) SQL statements that are high-load over the past week;
(2) SQL statements that are high-load over any day in the
statements that are high-load over an hour in the past week.
For example, a particular SQL statement may be executed on
least two times over the course of the past week are included
55
in the fourth category of SQL statements. Limiting the inclu
sion of SQL statements to only those statements that have
been executed at least twice ensures that no tuning resources
are expended on the occasional SQL statement that has been
executed only once over the course of an entire week. If an
SQL statement is unlikely to be executed again, tuning the
60
SQL statement will not be an ef?cient use of limited system
resources.
SQL tuning is a resource-intensive process, and it is likely
65
that not all the SQL statements identi?ed and included in the
four categories described above may be tuned within the
limited amount of time and resources allotted to SQL tuning.
Therefore, the SQL statements identi?ed in the four catego
ries may be further ranked and prioritized according to their
US 8,903,801 B2
5
6
relative importance so that during the tuning process, the SQL
estimates to better inform the cost-based optimizer with the
statements with the highest priorities are executed ?rst.
According to one embodiment, SQL statements within a
plans.
single category may be ordered by performance metrics that
are being optimized by the tuning process. The performance
During tuning, the SQL Tuning Advisor performs four
types of analyses: (1) statistics analysis; (2) SQL pro?ling;
metrics being optimized may be based on the most repeatable
execution statistics. For example, CPU time and buffer gets
(3) access path analysis; and (4) SQL structure analysis.
are known to repeat very reliably over multiple executions, so
the SQL statements in a single category may be ordered
according to a combination of CPU time and buffer get sta
tistics.
According to another embodiment, SQL statements are
tuned in an order that interweaves statements from each of the
tistics to generate execution plans. If the statistics are stale or
information it requires for producing superior execution
In normal mode, the query optimizer relies on object sta
missing, the execution plans that are generated may be poor.
During tuning, the SQL Tuning Advisor checks the object
statistics and generates recommendations to gather relevant
statistics for objects with stale or missing statistics. The iden
ti?cation of inaccurate statistics for an SQL statement is
described in further detail in “HIGH LOAD SQL DRIVEN
four categories. Interweaving SQL statements from each of
the four categories prevents a scenario where statements from
certain categories are always tuned while statements from
other categories are never tuned. Interweaving may be per
STATISTICS COLLECTION”, application Ser. No. 10/ 936,
427, ?led Sep. 7, 2004, the entire contents of which are
incorporated by reference herein.
In addition, the SQL Tuning Advisor also produces auxil
formed by assigning different weights to different categories.
A higher weight may be assigned to a category that contains
20
SQL statements over a larger span of time. For example, an
interweaving scheme may tune three statements from the ?rst
category, two statements from each of the second and third
categories, and one statement from the fourth category, before
returning to the ?rst category to select further statements for
25
iary information that includes statistics for objects with no
statistics and statistic adjustment factors for different esti
mates made by the query optimizer. The auxiliary informa
tion may be collected by gathering additional information
using sampling and partial execution techniques. According
to one embodiment, this auxiliary information is stored in an
tuning.
object called an SQL Pro?le. Each SQL Pro?le is speci?c to
According to another embodiment, a history of SQL state
ments that have been tuned recently is kept. This history
contains information about which SQL statements have been
tuned during a speci?c period of time, such as the preceding
week or the preceding month. An SQL statement that has
and associated with a single SQL statement. SQL Pro?les are
30
SQL Pro?les store statistic adjustment factors that are not
themselves statistics but that adjust the pre-existing statistics
been tuned recently (i.e., the SQL statement is contained in
the history) is automatically not identi?ed for tuning because
it is unlikely that an SQL statement that has already been
tuned recently will bene?t from further tuning. However, an
SQL statement that has been tuned recently may nonetheless
be identi?ed for tuning if the SQL statement meets another
criterion. For example, if the SQL statement’s execution sta
tistics indicate that the SQL statement’s performance has
deteriorated since the last time that the SQL statement has
been tuned, then this indicates that conditions in the database
system that affect the SQL statement may have changed since
the last time that the SQL statement was tuned, and that
retuning of the SQL statement may be bene?cial.
35
query predicate, so that a query optimizer that is generating an
40
execution plan for the particular SQL statement may consult
the SQL Pro?le to multiply any pre-existing cardinality esti
mates for the particular predicate in the particular SQL state
ment by 3. As such, execution plans that are generated based
on SQL Pro?les will be based on more accurate statistical
Tuning Identi?ed SQL Statements
Once the SQL statements have been identi?ed, they are
tuned in order of priority. The tuning of candidate SQL state
50
embodiment, the fully automated tuning process feeds the
SQL statements, one-by-one and in order of priority, to the
SQL Tuning Advisor, which then generates a set of tuning
estimates and will therefore be more optimized.
According to one embodiment, the SQL Advisor generates
tuning recommendations that recommend the acceptance of
SQL Pro?les. Once an SQL Pro?le for a particular SQL
statement is accepted, the SQL Pro?le is storedpersistently in
a data dictionary that associates the SQL Pro?le with the
particular SQL statement. After the SQL Pro?le is stored
persistently, the next time that the particular SQL statement is
analyzed by the query optimizer operating in normal mode,
recommendations for each SQL statement.
According to one embodiment, the SQL Tuning Advisor
and/or estimates of statistics of database objects. For
example, a cardinality estimate for a particular query predi
cate in a particular SQL statement may be 10%, while the
actual cardinality for that particular query predicate is 30%.
The SQL Pro?le for the particular SQL statement may then
contain a cardinality adjustment factor of 3 for the particular
45
ments is performed in step 104 in FIG. 1. According to one
described in further detail in “SQL PROFILE”, application
Ser. No. 10/936,205, ?led Sep. 7, 2004, the entire contents of
which are incorporated by reference herein.
55
the execution plan for the particular SQL statement will be
generated based on statistics that are adjusted by the adjust
uses the database system’s query optimizer that is set to
ment factors stored in the SQL Pro?le that is associated with
operate in tuning mode. Normally, the query optimizer of a
database system compiles SQL statements and generates
execution plans. In normal mode, the query optimizer oper
the particular SQL statement.
One advantage of using SQL Pro?les is that, unlike stored
ates with very strict time constraints, usually a fraction of a
second, during which time it must ?nd a good execution plan
for an SQL statement. In tuning mode, however, the optimizer
is under much less stringent time constraints, and can perform
longer and more thorough analyses to determine whether the
execution plan produced for an SQL statement in the normal
mode can be further improved. The output of the query opti
mizer in tuning mode is not execution plans, but a set of
60
outlines, an SQL Pro?le does not freeze the execution plan of
an SQL statement. Because an SQL Pro?le contains adjust
ment factors for statistics, these adjustment factors continue
to be relevant even when objects such as tables and indexes
grow, shrink, are created or are deleted, and even when the
data distribution or access path of the associated SQL state
65
ment changes. Therefore, an SQL Pro?le need not be regen
erated frequently. After a long period of time, however, an
SQL Pro?le may become outdated. At such times, a new SQL
US 8,903,801 B2
7
8
Pro?le may be generated for the associated SQL statement by
running the SQL Tuning Advisor again on the associated SQL
identi?ed as good candidates for tuning are tuned in order of
priority. Therefore, the tuning recommendations for the high
est-priority SQL statements would be implemented ?rst and
statement.
will unlikely be precluded from implementation by the cap on
The SQL Tuning Advisor may also perform access path
number of changes. The determination of which tuning rec
ommendations are to be implemented is made in step 108 of
analysis. During access path analysis, the SQL Tuning Advi
sor explores whether a new index can signi?cantly enhance
FIG. 1.
the performance of an SQL statement. If such an index is
identi?ed, a tuning recommendation is generated to recom
mend the creation of the index.
According to one embodiment, only tuning recommenda
tions that have resulted in performance improvement that
Finally, the SQL Tuning Advisor performs SQL structure
analysis. During SQL structure analysis, the SQL Tuning
meet a speci?c set of criteria are implemented. In one
Advisor identi?es common problems with the structure of
SQL statements that can lead to poor performance, including
execution time by at least threefold are implemented. The
threefold improvement is measured in terms of speci?c
syntactic, semantic, or design problems. Further details on
SQL structure analysis are described in “SQL STRUCTURE
execution statistics which are known to have consistent val
ues across multiple executions. CPU time and buffer gets
(logical I/Os) are two metrics that may be used to measure
improvement because CPU time and buffer gets are both
example, only tuning recommendations that improve the
ANALYZER”, application Ser. No. 10/ 936,426, ?led Sep. 7,
2004, the entire contents of which is hereby incorporated by
reference as if fully set forth herein. Relevant suggestions for
restructuring SQL statements are generated as tuning recom
mendations.
repeatable measurements that encompass important factors in
SQL performance.
20
According to another embodiment, only tuning recom
mendations that meet a speci?c set of safety criteria are
Testing the Tuning Recommendations
implemented. For example, in one example, only tuning rec
In order to determine how the tuning recommendations
generated by the SQL Tuning Advisor will affect the perfor
25
mance of SQL statements and to determine whether to imple
ment the tuning recommendations on the database system, the
tuning recommendations are tested in a test environment.
ments.
According to one embodiment, testing and execution services
such as the ones described in “TEST EXECUTION OF 30
USER SQL IN DATABASE SERVER CODE”, application
Ser. No. 12/217,249, ?led on Jul. 2, 2008, the entire contents
of which is hereby incorporated by reference as if fully set
forth herein, are used to perform testing of the tuning recom
mendations.
In the test environment, the SQL statements are executed
with the tuning recommendations enabled, and execution
statistics such as execution time are gathered. This is per
formed in step 106 in FIG. 1. To use the allocated testing time
most ef?ciently, the query plans are executed in rounds with
time limits that increase until at least one plan least amount of
ommendations that do not increase the I/O times of SQL
statements are implemented, even if the tuning recommenda
tions decrease the overall execution times of the SQL state
In step 110, the tuning recommendations that have been
determined to be implemented are implemented. For SQL
Pro?les, for example, this means that the SQL Pro?les are
storedpersistently in a data dictionary that associates the SQL
Pro?les with speci?c SQL statements. As discussed above,
once a particular SQL Pro?le is stored persistently, the next
time that the particular SQL statement is analyzed by the
query optimizer operating in normal mode, the execution plan
35
for the particular SQL statement will be generated based on
statistics that are adjusted by the adjustment factors stored in
the SQL Pro?le that is associated with the particular SQL
statement.
40
Running the Fully-Automated Tuning Process in a
Controlled Environment
system resources). Once this decision is made, the system
The automatic tuning of SQL statements is a resource
will terminate the execution of the plan shown to be worse;
this way, time will not be wasted executing a query plan which
might take a very long time to complete when another plan
has been shown to complete in much less tie. Further details
regarding the testing of alternative execution plans are
intensive and time-consuming process. The tuning process is
45 run in a controlled environment so that other activities on the
machine on which the tuning process is run are not inter
rupted. Furthermore, in the controlled environment, the tun
ing process may be restricted to run only for a speci?ed period
described in “TEST EXECUTION OF USER SQL IN
DATABASE SERVER CODE”, application Ser. No. 12/217,
249, ?led on Jul. 2, 2008.
50
of time.
According to one embodiment, the automatic tuning pro
cess is run in an automated maintenance task that is run on a
Choosing Tuning Recommendations to Implement
nightly basis. The frequency, begin time, and end time that the
automatic tuning process is run may be customized by the
One goal of the step of selecting which tuning recommen
dations to implement is to choose the subset of the tuning
recommendations generated from the tuning step that would
improve performance the most without implementing too
much change in the database system. According to one
embodiment, the results from the testing step just described
are analyzed, and only the tuning recommendations that
result in substantial bene?ts are implemented. Furthermore,
DBA.
55
Within the speci?ed period of time (e.g., one hour), the
tuning process performs the steps of: identifying candidate
SQL statements from the AWR for tuning; tuning each SQL
statement individually be calling the SQL Tuning Advisor;
testing the SQL pro?les generated by SQL Tuning Advisor;
60
in order to limit the number of changes made to the database
and optionally implementing the SQL pro?les if they meet the
criteria (e. g., three-fold performance improvement).
According to one embodiment, the fully-automated tuning
system on a daily basis, a limit on the number of actions taken
process described above is performed by an automated main
during maintenance may also be con?gured so that tuning
recommendations are implemented only if the number of
changes made does not already exceed the pre-con?gured
limit. As described above, SQL statements which have been
tenance task. The automated maintenance task caps the
resources used by the tuning process to a speci?c percentage
65
of the total resource consumption on the machine on which
the tuning process is being made. The automated mainte
US 8,903,801 B2
9
10
nance task also caps the total amount of time for the tuning
storing information and instructions to be executed by pro
process so that the tuning process does not run for an inordi
cessor 204. Main memory 206 also may be used for storing
temporary variables or other intermediate information during
execution of instructions to be executed by processor 204.
Computer system 200 further includes a read only memory
(ROM) 208 or other static storage device coupled to bus 202
for storing static information and instructions for processor
204. A storage device 210, such as a magnetic disk or optical
nately long period of time. Finally, the amount of time the
tuning process spends tuning each individual SQL statement
may be capped by the tuning process itself to prevent the
tuning process from spending too much time analyzing one
particular SQL statement. In addition, the total amount of
time the tuning process spends tuning all the selected SQL
statements may also be capped by the tuning process itself.
disk, is provided and coupled to bus 202 for storing informa
tion and instructions.
Computer system 200 may be coupled via bus 202 to a
display 212, such as a cathode ray tube (CRT), for displaying
information to a computer user. An input device 214, includ
For example, the automated maintenance task may cap the
total amount of time spent by the tuning process to four hours,
while the tuning process may cap the own total tuning time to
one hour and cap the tuning time for a single SQL statement
to twenty minutes. According to one embodiment, when any
of these time limits is reached, the tuning process may be
noti?ed and in response may complete the current tuning
ing alphanumeric and other keys, is coupled to bus 202 for
communicating information and command selections to pro
cessor 204.Another type of user input device is cursor control
216, such as a mouse, a trackball, or cursor direction keys for
activity in such a manner that ensures that the partial results
will be consumable by the user at a later time.
According to one embodiment, a separate and independent
mechanism monitors the total amount of time that the tuning
process has used. If the separate and independent mechanism
detects that the total amount of time used by the tuning pro
cess has exceeded the speci?ed cap, then the tuning process is
terminated.
According to another embodiment, the tuning process
communicating direction information and command selec
tions to processor 204 and for controlling cursor movement
20
freedom in two axes, a ?rst axis (e.g., x) and a second axis
(e.g., y), that allows the device to specify positions in a plane.
The invention is related to the use of computer system 200
for implementing the techniques described herein. According
25
204 executing one or more sequences of one or more instruc
tions with other sessions in the database system. When the
tuning process detects such a contention, it will stop tuning
the SQL statement currently being tuned and commence tun
30
action does not immediately resolve the contention, the tun
ing process may be aborted entirely.
Monitoring the System after Implementation of
Tuning Recommendations
tions contained in main memory 206. Such instructions may
be read into main memory 206 from another machine-read
able medium, such as storage device 210. Execution of the
sequences of instructions contained in main memory 206
causes processor 204 to perform the process steps described
herein. In alternative embodiments, hard-wired circuitry may
35
be used in place of or in combination with software instruc
tions to implement the invention. Thus, embodiments of the
invention are not limited to any speci?c combination of hard
ware circuitry and software.
After the tuning recommendations are implemented, the
database system is monitored to detect when the tuning rec
The term “machine-readable medium” as used herein
refers to any medium that participates in providing data that
ommendations are used and to measure the bene?ts form the
tuning recommendations. This is performed in step 112 of
to one embodiment of the invention, those techniques are
performed by computer system 200 in response to processor
monitors whether or not its actions are causing any conten
ing the SQL statement with the next highest priority. If this
on display 212. This input device typically has two degrees of
40
causes a machine to operation in a speci?c fashion. In an
FIG. 1. According to one embodiment, if the bene?t from a
embodiment implemented using computer system 200, vari
particular tuning recommendation is less than its anticipated
ous machine-readable media are involved, for example, in
providing instructions to processor 204 for execution. Such a
medium may take many forms, including but not limited to
bene?t, the recommendation is reverted.
Reporting Results of the Tuning Process
45
storage media and transmission media. Storage media
includes both non-volatile media and volatile media. Non
According to one embodiment, information gathered dur
ing the tuning process is compiled into a report, which can
then be reviewed by the DBA. This report may include, for
example, a list of the SQL statements that were tuned, the
volatile media includes, for example, optical or magnetic
disks, such as storage device 210. Volatile media includes
dynamic memory, such as main memory 206. Transmission
50
tuning recommendations generated by the SQL Tuning Advi
media can also take the form of acoustic or light waves, such
as tho se generated during radio -wave and infra-red data com
munications. All such media must be tangible to enable the
sor, the results from testing the tuning recommendations, and
a list of which tuning recommendations were implemented.
The DBA may examine this report to implement additional
tuning recommendations or to remove any tuning recommen
media includes coaxial cables, copper wire and ?ber optics,
including the wires that comprise bus 202. Transmission
55
instructions carried by the media to be detected by a physical
mechanism that reads the instructions into a machine.
dations that were automatically implemented.
Common forms of machine-readable media include, for
example, a ?oppy disk, a ?exible disk, hard disk, magnetic
Hardware Overview
tape, or any other magnetic medium, a CD-ROM, any other
FIG. 2 is a block diagram that illustrates a computer system
200 upon which an embodiment of the invention may be
implemented. Computer system 200 includes a bus 202 or
other communication mechanism for communicating infor
mation, and a processor 204 coupled with bus 202 for pro
cessing information. Computer system 200 also includes a
60
optical medium, punchcards, papertape, any other physical
medium with patterns of holes, a RAM, a PROM, and
EPROM, a FLASH-EPROM, any other memory chip or car
tridge, a carrier wave as described hereinafter, or any other
medium from which a computer can read.
65
Various forms of machine-readable media may be involved
main memory 206, such as a random access memory (RAM)
in carrying one or more sequences of one or more instructions
or other dynamic storage device, coupled to bus 202 for
to processor 204 for execution. For example, the instructions
US 8,903,801 B2
11
12
may initially be carried on a magnetic disk of a remote com
What is claimed is:
puter. The remote computer can load the instructions into its
dynamic memory and send the instructions over a telephone
line using a modem. A modem local to computer system 200
from a workload set, identifying a plurality of database
can receive the data on the telephone line and use an infra-red
transmitter to convert the data to an infra-red signal. An
wherein the workload set comprises database query lan
guage statements and current performance data for the
infra-red detector can receive the data carried in the infra-red
database query language statements;
executing each database query language statement from
said plurality of query language statements against a
1. A computer-implemented method comprising steps of:
query language statements for automatic tuning,
signal and appropriate circuitry can place the data on bus 202.
Bus 202 carries the data to main memory 206, from which
processor 204 retrieves and executes the instructions. The
database;
collecting new performance data from said executing each
database query language statement, said collecting com
prising measuring resource usage by said executing each
database query language statement;
detecting that conditions in said database that affect
instructions received by main memory 206 may optionally be
stored on storage device 210 either before or after execution
by processor 204.
Computer system 200 also includes a communication
interface 218 coupled to bus 202. Communication interface
218 provides a two-way data communication coupling to a
executing said plurality of database query language
statements changed based at least in part on comparison
of the new performance data with the current perfor
network link 220 that is connected to a local network 222. For
example, communication interface 218 may be an integrated
services digital network (ISDN) card or a modem to provide
a data communication connection to a corresponding type of
mance data;
20
telephone line. As another example, communication interface
218 may be a local area network (LAN) card to provide a data
communication connection to a compatible LAN. Wireless
links may also be implemented. In any such implementation,
communication interface 218 sends and receives electrical,
25
electromagnetic or optical signals that carry digital data
streams representing various types of information.
Network link 220 typically provides data communication
language statement from saidplurality of database query
language statements, wherein the new performance data
is different from the current performance data for the
database query language statement;
wherein the tuning the subset of database query language
statements comprises generating a plurality of tuning
through one or more networks to other data devices. For
example, network link 220 may provide a connection through
in response to the detecting, tuning a subset of database
query language statements from said plurality of data
base query language statements, said subset of database
query language statements comprising a database query
30
recommendations for execution of the subset of data
base query language statements;
local network 222 to a host computer 224 or to data equip
ment operated by an Internet Service Provider (ISP) 226. ISP
226 in turn provides data communication services through the
testing the plurality of tuning recommendations against
world wide packet data communication network now com
monly referred to as the “Internet” 228. Local network 222
recommendations comprises, for each tuning recom
mendation of said plurality of tuning recommendations:
executing a respective database query language state
ment from said subset of database query language
statements with said each tuning recommendation
said database, wherein the testing the plurality of tuning
35
and Internet 228 both use electrical, electromagnetic or opti
cal signals that carry digital data streams. The signals through
the various networks and the signals on network link 220 and
through communication interface 218, which carry the digital
data to and from computer system 200, are exemplary forms
of carrier waves transporting the information.
Computer system 200 can send messages and receive data,
enabled;
40
including program code, through the network(s), network
link 220 and communication interface 218. In the Internet
example, a server 230 might transmit a requested code for an
resource usage comprises processor time or buffer
45
application program through Internet 228, ISP 226, local
network 222 and communication interface 218.
The received code may be executed by processor 204 as it
is received, and/or stored in storage device 210, or other
non-volatile storage for later execution. In this manner, com
guage statement with said each tuning recommenda
based on the testing, determining a subset of said plurality
50
In the foregoing speci?cation, embodiments of the inven
mendations; and
tion have been described with reference to numerous speci?c
55
ments that have been executed over a speci?c period of time
60
for terms contained in such claims shall govern the meaning
element, property, feature, advantage or attribute that is not
sense.
wherein the steps are automatically performed by one or
more computing devices.
2. The computer-implemented method of claim 1, wherein
the workload set comprises database query language state
of such terms as used in the claims. Hence, no limitation,
expressly recited in a claim should limit the scope of such
claim in any way. The speci?cation and drawings are, accord
ingly, to be regarded in an illustrative rather than a restrictive
of tuning recommendations resulted in performance
improvement that meets a speci?c set of criteria;
implementing the subset of said plurality of tuning recom
a carrier wave.
speci?c form in which such claims issue, including any sub
sequent correction. Any de?nitions expressly set forth herein
gets; and
measuring bene?ts based on performance improvement
of said executing the respective database query lan
tion enabled;
puter system 200 may obtain application code in the form of
details that may vary from implementation to implementa
tion. Thus, the sole and exclusive indicator of what is the
invention, and is intended by the applicants to be the inven
tion, is the set of claims that issue from this application, in the
measuring resource usage by said executing the respec
tive database query language statement with said each
tuning recommendation enabled, wherein the
65
and performance data for the database query language state
ments that have been executed over the speci?c period of
time.
3. The computer-implemented method of claim 2, wherein
the identifying the plurality of database query language state
ments for automatic tuning comprises identifying a set of
database query language statements as having long execution
times and high frequencies of execution during the speci?c
period of time.
US 8,903,801 B2
14
13
13. The computer-implemented method of claim 1,
4. The computer-implemented method of claim 1, wherein
the subset of database query language statements are priori
wherein the resource usage comprises both processor time
tized, further comprising:
and buffer gets.
14. The computer-implemented method of claim 1,
wherein the implementing the subset of said plurality of
tuning recommendations includes storing in association
with a particular database query language statement of
said subset of database query language statements
automatically tuning the sub set of database query language
statements in order of priority.
5. The computer-implemented method of claim 1, wherein
the identifying the plurality of database query language state
ments for automatic tuning and tuning the subset of database
query language statements from the plurality of database
respective one or more adjustment factors.
query language statements are performed in a controlled envi
15. The computer-implemented method of claim 14 further
ronment on a machine in a manner such that activities in the
comprises:
controlled environment do not interrupt activities on the
machine outside the controlled environment.
generating an execution plan for said particular database
query language statement, wherein the generating the
6. The computer-implemented method of claim 5, wherein
execution plan comprises determining that said particu
the controlled environment limits, to a maximum amount of
lar database query language statement is associated with
said respective one or more adjustment factors, wherein
the execution plan is generated based on said respective
time, time spent on performing the identifying the plurality of
database query language statements for automatic tuning and
tuning the sub set of database query language statements from
the plurality of database query language statements.
7. The computer-implemented method of claim 5, wherein
one or more adjustment factors.
20
a time limit enforcement mechanism external to the con
trolled environment limits, to a maximum amount of time,
tions which, when executed by one or more processors, cause
the one or more processors to perform steps of:
time spent on performing the identifying the plurality of
database query language statements for automatic tuning and
tuning the sub set of database query language statements from
the plurality of database query language statements.
8. The computer-implemented method of claim 5, wherein:
the controlled environment periodically checks if the
activities in the controlled environment are causing any
contention with an activity outside the controlled envi
ronment; and
the controlled environment aborts the activities in the con
trolled environment upon detection that the activities in
from a workload set, identifying a plurality of database
25
30
35
40
statements changed based at least in part on comparison
of the new performance data with the current perfor
45
in response to the detecting, tuning a subset of database
query language statements from said plurality of data
base query language statements, said subset of database
query language statements comprising a database query
mance data;
language statement from saidplurality of database query
language statements, wherein the new performance data
is different from the current performance data for the
database query language statement;
wherein the tuning the subset of database query language
wherein the enabling said each tuning recommendation
against said database causes a number of database changes,
wherein the number of database changes is below a maximum
number of database changes.
11. The computer-implemented method of claim 9,
wherein the tuning the subset of database query language
statements comprises generating a plurality of tuning
recommendations for execution of the subset of data
statements until one or more time periods are reached or
base query language statements;
exceeded includes at least one of:
55
subset of database query language statements until a
particular time period of said one or more time periods is
reached or exceeded; and
60
number of database changes.
ment from said subset of database query language
statements with said each tuning recommendation
enabled;
reached or exceeded.
12. The computer-implemented method of claim 1,
wherein the enabling said each tuning recommendation
against said database causes a number of database changes,
wherein the number of database changes is below a maximum
testing the plurality of tuning recommendations against
said database, wherein the testing the plurality of tuning
recommendations comprises, for each tuning recom
mendation of said plurality of tuning recommendations:
executing a respective database query language state
tuning multiple database query language statements of said
subset of database query language statements until a
single time period of said one or more time periods is
collecting new performance data from said executing each
database query language statement, said collecting com
prising measuring resource usage by said executing each
database query language statement;
detecting that conditions in said database that affect
executing said plurality of database query language
exceeded, thereby generating the plurality of tuning recom
tuning a single database query language statement of said
database query language statements;
executing each database query language statement from
said plurality of query language statements against a
database;
performed until one or more time periods are reached or
mendations for a particular subset of database query language
statements of said subset of database query language state
ments, each tuning recommendation of said plurality of tun
ing recommendations being a tuning recommendation for a
particular database query language statement of said subset of
database query language statements.
10. The computer-implemented method of claim 9,
query language statements for automatic tuning,
wherein the workload set comprises database query lan
guage statements and current performance data for the
the controlled environment are causing a contention
with the activity outside the controlled environment.
9. The computer-implemented method of claim 1, wherein
the tuning the subset of database query language statements is
16. A computer-readable non-transitory storage medium
storing instructions, wherein the instructions include instruc
65
measuring resource usage by said executing the respec
tive database query language statement with said each
tuning recommendation enabled, wherein the
resource usage comprises processor time or buffer
gets; and
US 8,903,801 B2
15
16
measuring bene?ts based on performance improvement
of said executing the respective database query lan
the controlled environment are causing a contention
with the activity outside the controlled environment.
24. The computer-readable storage medium of claim 16,
wherein the tuning the subset of database query language
guage statement with said each tuning recommenda
tion enabled;
based on the testing, determining a subset of said plurality
statements is performed until one or more time periods are
of tuning recommendations resulted in performance
reached or exceeded, thereby generating the plurality of tun
ing recommendations for a particular subset of database
improvement that meets a speci?c set of criteria; and
implementing the subset of said plurality of tuning recom
query language statements of said subset of database query
mendations.
language statements, each tuning recommendation of said
plurality of tuning recommendations being a tuning recom
17. The computer-readable storage medium of claim 16,
wherein the workload set comprises database query language
mendation for a particular database query language statement
of said subset of database query language statements.
statements that have been executed over a speci?c period of
time and performance data for the database query language
statements that have been executed over the speci?c period of
25. The computer-readable storage medium of claim 24,
wherein the enabling said each tuning recommendation
time.
against said database causes a number of database changes,
wherein the number of database changes is below a maximum
18. The computer-readable storage medium of claim 17,
wherein the identifying the plurality of database query lan
guage statements for automatic tuning comprises identifying
a set of database query language statements as having long
execution times and high frequencies of execution during the
speci?c period of time.
19. The computer-readable storage medium of claim 16,
20
statements until one or more time periods are reached or
exceeded includes at least one of:
wherein the subset of database query language statements are
tuning a single database query language statement of said
prioritized, the instructions further comprising instructions
for:
automatically tuning the sub set of database query language
statements in order of priority.
20. The computer-readable storage medium of claim 16,
wherein the identifying the plurality of database query lan
guage statements for automatic tuning and tuning the subset
of database query language statements from the plurality of
25
subset of database query language statements until a
single time period of said one or more time periods is
30
activities in the controlled environment do not interrupt
35
21. The computer-readable storage medium of claim 20,
wherein the controlled environment limits, to a maximum
40
22. The computer-readable storage medium of claim 20,
45
time spent on performing the identifying the plurality of
database query language statements for automatic tuning and
tuning the sub set of database query language statements from
the plurality of database query language statements.
23. The computer-readable storage medium of claim 20,
wherein:
the controlled environment periodically checks if the
activities in the controlled environment are causing any
contention with an activity outside the controlled envi
ronment; and
the controlled environment aborts the activities in the con
trolled environment upon detection that the activities in
against said database causes a number of database changes,
wherein the number of database changes is below a maximum
number of database changes.
28. The computer-readable storage medium of claim 16,
wherein the
resource usage comprises both processor time and buffer
statements.
wherein a time limit enforcement mechanism external to the
controlled environment limits, to a maximum amount of time,
reached or exceeded.
27. The computer-readable storage medium of claim 16,
wherein the enabling said each tuning recommendation
database query language statements are performed in a con
amount of time, time spent on performing the identifying the
plurality of database query language statements for automatic
tuning and tuning the subset of database query language
statements from the plurality of database query language
subset of database query language statements until a
particular time period of said one or more time periods is
reached or exceeded; and
tuning multiple database query language statements of said
trolled environment on a machine in a manner such that
activities on the machine outside the controlled environment.
number of database changes.
26. The computer-readable storage medium of claim 24,
wherein the tuning the subset of database query language
50
55
gets.
29. The computer-readable storage medium of claim 16,
wherein the implementing the subset of said plurality of
tuning recommendations includes storing in association
with a particular database query language statement of
said subset of database query language statements
respective one or more adjustment factors.
30. The computer-readable storage medium of claim 29,
wherein the instructions further comprise instructions for:
generating an execution plan for said particular database
query language statement,
wherein the generating the execution plan comprises
determining that said particular database query lan
guage statement is associated with said respective one
or more adjustment factors, wherein the execution
plan is generated based on said respective one or more
adjustment factors.
*
*
*
*
*
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertisement