Tải bản đầy đủ (.pdf) (505 trang)

the official new features guide to sybase ase 15

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (24.29 MB, 505 trang )

“Sybase has been dead a very long time.
May they rest in peace.”
Larry Ellison
CEO, Oracle Inc.
This page intentionally left blank.
Several years later…
The Official NewThe Official New
Features Guide toFeatures Guide to
Sybase
®
ASE 15ASE 15
Brian Taylor, Naresh Adurty,Brian Taylor, Naresh Adurty,
Steve Bradley, and Carrie KingSteve Bradley, and Carrie King
Taylor
with Mark A. Shelton and Jagan Reddywith Mark A. Shelton and Jagan Reddy
Wordware Publishing, Inc.Wordware Publishing, Inc.
Library of Congress Cataloging-in-Publication Data
Taylor, Brian.
The official new features guide to Sybase ASE 15 / by Brian Taylor [et al.].
p. cm.
Includes index.
ISBN-13: 978-1-59822-004-9
ISBN-10: 1-59822-004-7 (pbk.)
1. Client/server computing. 2. Sybase. I. Taylor, Brian (Brian Robert), 1972- .
QA76.9.C55O4 2006
005.2'768 dc22 2005036445
© 2006, Wordware Publishing, Inc.
All Rights Reserved
2320 Los Rios Boulevard
Plano, Texas 75074


No part of this book may be reproduced in any form or by any means
without permission in writing from Wordware Publishing, Inc.
Printed in the United States of America
ISBN-13: 978-1-59822-004-9
ISBN-10: 1-59822-004-7
10987654321
0602
Sybase, Adaptive Server, and the Sybase Fibonacci symbol are registered trademarks of Sybase, Inc. in the
United States of America and/or other countries. Other brand names and product names mentioned in this book
are trademarks or service marks of their respective companies. Any omission or misuse (of any kind) of service
marks or trademarks should not be regarded as intent to infringe on the property of others. The publisher
recognizes and respects all marks used by companies, manufacturers, and developers as a means to distinguish
their products.
This book is sold as is, without warranty of any kind, either express or implied, respecting the contents of this
book and any disks or programs that may accompany it, including but not limited to implied warranties for the
book’s quality, performance, merchantability, or fitness for any particular purpose. Neither Wordware
Publishing, Inc. nor its dealers or distributors shall be liable to the purchaser or any other person or entity with
respect toany liability, loss, or damage caused or alleged to have been caused directly or indirectly by this book.
Portions of this book contain charts, graphs, tables, and other materials that are copyrighted by Sybase, Inc., and
are used with permission.
All inquiries for volume purchases of this book should be addressed to Wordware Publishing, Inc.,
at the above address. Telephone inquiries may be made by calling:
(972) 423-0090
SYBASE, INC., AND ITS SUBSIDIARIES DO NOT TAKE ANY
RESPONSIBILITY FOR THE CONTENT OF THE BOOK.
SYBASE DISCLAIMS ANY LIABILITY FOR INACCURACIES,
MISINFORMATION, OR ANY CONTENT CONTAINED IN, OR
LEFT OUT OF THIS BOOK.
This page intentionally left blank.
Dedications

To my family, tons! — BRT
To Karen, Mom, and Dad — NA
To my best friend and wife, Carol — SWB
To my boys — CKT
vii
This page intentionally left blank.
Contents
Foreword xix
Acknowledgments xxi
About the Authors xxv
Introduction xxvii
Part I: New Features Overview
Chapter 1 Exploring the Sybase Galaxy 3
Part I — New Features Overview 4
System Maintenance Improvements 4
Partition Management — Semantic Partitions 5
Scrollable Cursors 5
Overview of Changes to Query Processing 6
Detection and Resolution of Performance Issues in Queries . . . 6
Computed Columns 7
Functional Indexes 7
Capturing Query Processing Metrics 8
Plan Viewer 9
Sybase Software Asset Management (SySAM) 2.0 9
Installation of ASE 15 9
Part II — Pre-15 Improvements 10
Multiple tempdb Databases 10
MDA Tables 10
Java and XML 11
The Appendices 11

Sample Certification Exam 11
Use Cases 11
3, 2, 1, Contact! 12
Chapter 2 System Maintenance Improvements 13
Recent Pre-ASE 15 Improvements 13
Multiple tempdb 14
Native Data Encryption/Security Enhancements 14
Automatic Database Expansion 15
The Basics 16
Job Scheduler 18
Basic Components 18
Installation of Job Scheduler 18
ASE 15 Improvements 19
ix
Row Locked System Catalogs 19
Update Statistics 20
Updates to Partition Statistics 20
Automatic Update Statistics 22
Datachange 22
Why Use datachange? 27
Datachange, Semantic Partitions, and Maintenance Schedules . 28
Local Indexes 31
Benefits 31
sp_helpindex 32
Partition-level Utilities 33
Partition Configuration Parameters 34
Utility Benefits from Semantic Partitions 35
Partition-specific Database Consistency Checks (dbccs) . . 35
Reorg Partitions 38
Changes to the bcp Utility 39

Truncate Partitions 43
Very Large Storage System 44
Disk Init 45
Large Identifiers 45
Long Identifiers 46
Short Identifiers 46
Unicode Text Support 47
New Datatypes 47
New Functions 48
Deprecated Functions 50
New Configuration Parameters 51
Eliminated Configuration Parameters 52
New Global Variables 52
Summary 52
Chapter 3 Semantic Partitions and Very Large Database (VLDB) Support 53
Introduction 53
Why Partition Data? 55
Benefits of Partitioning 56
Partition Terminology 57
Semantic Partitions 61
Configuring ASE for Semantic Partitioning 62
Partition Support in ASE 15 63
Partition Types 64
Range Partitioning 65
Hash Partitioning 70
List Partitioning 75
Round-robin Partitioning 78
x
Contents
Partitioning Strategies 83

Inserting, Updating, and Deleting Data in Partitions 84
Inserting Data into Semantic Partitions 84
Inserting Data into Range Partitions 84
Inserting Data into Hash Partitions 86
Inserting Data into List Partitions 86
Deleting Data from All Semantic Partitions 86
Updating Data in All Semantic Partitions 86
Built-in Functions 87
Data Partition Implementation and Upgrade Strategies 89
Index Partitioning 93
Local Index 94
Clustered Prefixed Index on Range Partitioned Table . . . 95
Clustered Non-Prefixed Index on Range
Partitioned Table 97
Clustered Prefixed Index on List Partitioned Table 99
Clustered Non-Prefixed Index on List
Partitioned Table 101
Clustered Prefixed Index on Round-robin
Partitioned Table 104
Clustered Non-Prefixed Index on Round-robin
Partitioned Table 106
Clustered Non-Prefixed Index on Hash
Partitioned Table 108
Clustered Prefixed Index on Hash Partitioned Table . . . 110
Global Index 113
Global Nonclustered Prefixed Index on Range
Partitioned Table 114
Global Nonclustered Prefixed Index on List
Partitioned Table 116
Global Nonclustered Prefixed Index on

Round-robin Partitioned Table 118
Global Nonclustered Prefixed Index on Hash
Partitioned Table 120
Query Processor and Partition Support 122
ASE 15 Optimizer 124
Partition Maintenance 124
Altering Data Partitions 124
Unpartition a Table 125
Change the Number of Partitions 126
Add a Partition to a Table 126
Drop Partitions 130
Modifications to the Partition Key 131
Partition Information 134
Contents
xi
Influence of Partitioning on DBA Activities 143
Influence of Partitioning on Long-time Archival 143
Summary 144
Chapter 4 Scrollable Cursors 145
Introduction 145
Scrollable Cursor Background 146
Cursor Scrollability 146
Cursor-related Global Variables 148
Changes to the sp_cursorinfo System Procedure 150
Be Aware of Scrollable Cursor Rules! 151
Cursor Sensitivity 152
Demonstration 1: Update to a Row Already Fetched 154
Demonstration 2: Update to a Row Not Yet Fetched 156
Cursor Sensitivity — An Exception 157
Locking Considerations with Cursors 158

Impact on tempdb Usage 159
Worktable Materialization with Scrollable Sensitive
Cursors 160
Conclusion of Sensitive vs. Insensitive Cursors 163
Sybase Engineer’s Insight 164
Summary 164
Future Direction 165
Chapter 5 Overview of Changes to the Query Processing Engine 167
Introduction 167
Optimization Goals 168
allrows_oltp 168
allrows_mix 169
allrows_dss 169
Determining the Current Optimization Goal 170
Optimization Criteria 170
merge_join 171
merge_union_all 171
merge_union_distinct 171
multi_table_store_ind 171
opportunistic_distinct_view 171
parallel_query 171
hash_join 172
Optimization Timeout Limit 172
Query Processor Improvements 174
Datatype Mismatch 175
Partition Elimination and Directed Joins 177
Tables with Highly Skewed Histogram Values 179
Group By and Order By 181
xii
Contents

or Queries 182
Star Queries 182
Summary 185
Chapter 6 Detection and Resolution of Query Performance Issues 187
Introduction 187
An Approach to Poor Query Performance Diagnosis 188
Common Query Performance Factors 190
Eliminating Causes for Sub-Optimal Plan Selection 191
Find Missing or Invalid Statistics 191
Consider Range Cell Density on Non-Unique Indexes . . 191
Identify Index Needs 192
Identify Poor Index Strategy 192
Fragmentation of Data 192
Resolve Partition Imbalance 193
Reset Server- or Session-level Options 193
Overengineered Forceplan 194
Invalid Use of Index Force 194
Inefficient Query Plan Forced by Abstract Plan 195
Query Processor “set options” — The Basics 195
Query Optimizer Cost Algorithm 198
ASE 15 vs. 12.5.x Cost Algorithm 199
Query Processor “set options” — Explored 200
show_missing_stats 200
show_elimination 203
show_abstract_plan 204
Why Use Abstract Plans for ASE 15? 207
Application of Optimization Tools 208
Optimization Goal Performance Analysis 208
Optimization Criteria Performance Analysis 210
Optimization Timeout Analysis 212

Suggested Approach to Fix Optimization
Timeout Problems 216
Detection, Resolution, and Prevention of Partition-related
Performance Issues 217
Data Skew Due to Incorrect Partition Type or
Poor Partition Key Selection 218
Effect of Invalid Statistics on Table Semantically
Partitioned 220
Summary 223
Chapter 7 Computed Columns 225
Introduction 225
Key Concepts 226
Materialization 226
Contents
xiii
Deterministic Property 228
Relationship between Deterministic Property and
Materialization 229
Deterministic and Materialized Computed Columns . . . 229
Deterministic and Nonmaterialized Computed
Columns 229
Nondeterministic and Materialized Computed
Columns 230
Nondeterministic and Nonmaterialized Computed
Columns 230
Benefits of Using Computed Columns 231
Provide Shorthand and Indexing for an Expression 231
Composing and Decomposing Datatypes 231
User-defined Sort Order 232
Rules and Properties of Computed Columns 233

Sybase Enhancements to Support Computed Columns 235
Create Table Syntax Change 235
Alter Table Syntax Change 235
System Table Changes 236
Stored Procedure Changes 237
Summary 239
Chapter 8 Functional Indexes 241
Computed Column Index 242
Purpose 242
Rules and Properties of a Computed Column Index 246
Feature Benefits 246
Feature Limitations 248
Impacts to tempdb 248
Impact to Existing Application Code 249
Determining When to Use a Computed Column Index 250
Optimizer Statistics 251
Function-based Index 251
Purpose 251
Rules and Properties of a Function-based Index 252
Feature Benefits 253
Feature Limitations 256
Impacts to tempdb 256
Impact to Existing Application Code 257
Determining the Use of a Function-based Index 257
Optimizer Statistics 258
Behind the Scenes 258
Getting Index Information 258
Summary 259
xiv
Contents

Chapter 9 Capturing Query Processing Metrics 261
Alternatives to Query Processing Metrics 261
Introduction to Query Processing Metrics 262
Contents of sysquerymetrics 263
Contents of the sysquerymetrics View 264
How to Enable QP Metrics Capture 265
Captured Information Explored 266
Stored Procedures 266
Triggers and Views 270
Execute Immediate 270
Accessing Captured Plans 271
How Is the QP Metrics Information Useful? 273
Identification of Performance Regression 276
Comparing Metrics for a Specific Query between
Running Groups 277
Comparing Metrics for All Queries between Running
Groups 279
Why Separate the QP Metrics Data by gid? 280
Syntax Style Matters; Spacing Does Not 281
Clearing and Saving the Metrics 283
Relationship between Stats I/O and QP Metrics I/O Counts 284
Information for Resource Governor 285
Space Utilization Considerations 285
Limitations 286
Summary 286
Chapter 10 Graphical Plan Viewer 287
Graphical Plan Viewer from Interactive SQL 287
Graphical Query Tree Using Set Options 294
Summary 296
Chapter 11 Sybase Software Asset Management (SySAM) 2.0 297

Introduction 297
Prior to ASE 15 298
With ASE 15 299
Components of Asset Management 299
SySAM Server 299
SySAM Utility Program — lmutil 300
SySAM Reporting Tool 300
System Environment Variables 301
License File 302
Options File 303
Properties File 303
The SySAM Environment 304
Standalone License Server 304
xv
Contents
Networked License Server 305
Redundant License Server 305
Acquiring Product Licenses 306
Product Licenses 309
TryandBuy 309
License Activation 309
SySAM Administration 310
sp_lmconfig 310
ASE 15 SySAM Upgrade Process 312
SySAM Reporting 313
Summary Reports 313
Server Usage Reports 319
Raw Data Reports 320
Summary 321
Chapter 12 Installation of ASE Servers 323

Prior to Installation for All Methods 324
Installation with Resource Files 325
Notes for Resource File Installation of ASE 325
Installation of ASE Components with a Resource File 330
GUI Installation Method with srvbuild Executable 332
Installation with the Dataserver Executable 352
Summary 356
Part II: Pre-15 Improvements
Chapter 13 Multiple Temporary Databases 359
Introduction 359
Purposes for Multiple Temporary Databases 360
Prior to ASE 15 360
With ASE 15 361
System Catalog Changes 361
directio Support 361
update statistics 363
Insensitive Scrollable Cursors 364
Semi-sensitive Scrollable Cursors 364
Sensitive Scrollable Cursors 364
How to Decide When to Add a Temporary Database 365
Strategies 365
What Are Your Needs? 366
Implementation Steps 367
Determining Available Temporary Databases 368
Sample Setup for Temporary Database for “sa” Use Only 369
Other Issues 371
xvi
Contents
Dropping Temporary Databases 371
Altering a Temporary Database 372

@@tempdb 372
Summary 372
Chapter 14 The MDA Tables 373
What Are the MDA Tables? 373
Past Solutions 374
MDA Table Installation 376
MDA Table Server Configuration Options 377
The Parent Switch 379
The MDA Tables 380
Changes from ASE 12.5.3 382
What Is Meant by “stateful” Tables? 383
Stateful MDA Table Data Management 385
SQLUse 391
Useful MDA Table Queries 391
MDA Alternatives 393
Summary 393
Chapter 15 Java, XML, and Web Services in ASE 395
Introduction 396
Java in the Database 396
Installing Java Classes 397
Creating Java Classes and JARs 397
Using the installjava Utility 398
Configuring Memory for Java in the Database 398
Java Classes as Datatypes 399
An Example of Table Definition Using a Java Class . . . 400
Performance Considerations 400
An Example of Using a Java Class within a Select 400
Executing Java Methods 400
Class Static Variables 401
Recommendations and Considerations 401

XML in the Database 402
XML Stored in the Database 402
Option 1: Store the XML Document into a
Text Datatype 403
Option 2: Store the XML Document into an
Image Datatype Using xmlparse 404
Option 3: Store the XML Document into an
Image Datatype Using Compression 404
Option 4: Store the XML Document Outside
the Database 405
HTML Stored in the Database 406
Contents
xvii
Recommendations and Considerations 406
Performance and Sizing 407
SQL Result Sets Converted to Return an XML Document. . . 410
Web Services 411
Web Services Producer 411
Web Services Consumer 413
Recommendations and Considerations 415
Appendix A Sybase ASE 15 Certification Sample Questions and Answers 417
Appendix B Use Cases 447
Index 467
xviii
Contents
Foreword
Sybase Adaptive Server Enterprise (ASE) has been a leading
RDBMS for mission-critical applications for almost two decades.
With ASE 15, Sybase has continued the tradition of introducing
leading edge database technologies to address our customers’ needs.

These technologies cover security, unstructured data management,
and operational intelligence. ASE 15 provides significant improve
-
ments for DSS and OLTP applications thanks to innovative query
processing technology. The result is a clear understanding of the opti
-
mal usage of the features and functionality.
The Official New Features Guide to Sybase ASE 15 is the first
book describing ASE 15. Of particular interest are details about new
features such as semantic partitions, computed columns, function
indexes, and scrollable cursors. The book is valuable also for its guid-
ance for diagnosing, resolving, and optimizing the overall system
performance.
The authors collectively have more than 40 years of experience
with Sybase ASE as DBAs at some of Sybase’s largest and most
demanding customers. Their background has enabled them to create
a book with great practical value.
The authors’ material is presented in a way that is useful to read-
ers independent of their experience level with ASE. The Official New
Features Guide to Sybase ASE 15 will be an invaluable asset to
DBAs, developers, and consultants working with Sybase ASE.
Dr. Raj Nathan
Senior Vice President
Information Technology Solutions Group
Sybase, Inc.
xix
This page intentionally left blank.
Acknowledgments
The authors would like to thank Celeste Noren for starting this whole
process. Your continual support and upbeat attitude have allowed us

to stay focused on the job at hand. We thank Joe Pearl for his tireless
and thorough editing and brilliant input. Special thanks to Irfan Khan
at Sybase Engineering for providing us with early access to the new
features and documentation for ASE 15. We need to thank
Rob Verschoor, Mark Kusma, and Jeff Tallman of Sybase for their
thorough technical reviews and timely feedback. We thank Joan
Fronske and Tom Traubitz from Sybase Marketing for making all
the arrangements with Sybase. We would like to thank Tim McEvoy
at Wordware Publishing for getting this book put together in such a
timely manner. A special thanks goes to Dean Kent for his legal
counsel during the process and for all the good lunches. Mostly,
we would like to thank our families for being understanding and
gracious.
xxi
I would like to start by recognizing the talented and dedicated group
of authors — Steve Bradley, Naresh Adurty, and Carrie King Taylor
— who accepted my challenge to create this book about the new fea
-
tures for Sybase ASE 15. With all of the personal challenges and
commitments we each faced during the development of this book,
I’m even more pleased with the final product. As our careers diverge
in the future, I’m sure each of us will fondly recall the many chal
-
lenges, good times, and late nights spent on the development of this
book.
Next, I want to personally thank the many Sybase employees
who helped with this book in many capacities: Celeste Noren, Joe
Pearl, Rob Verschoor, Irfan Khan, Jeff Tallman, Mark Kusma, Joan
Fronske, and Tom Traubitz.
I also need to thank the many friends and family members in my

life: my parents, Art and Nancy, my brother, Grant, Aunt Soozie,
Frank, Carol, and my grandfather Robert Taylor, who left this world
during the writing of this book. I also want to thank some of my
friends who have made life very interesting and with whom I have
shared many of life’s milestones: Steve, Daryl, Dave, Chris, and
Mike.
I owe the biggest thanks to my family, especially my wife and
co-author, Carrie. I appreciate how you are able to keep me moti-
vated, and still find time for our boys and your contributions to this
book. You are the reason and motivation for my success. I sure love
you! I also owe many great big hugs and kisses to my two big boys,
Elliot and Jonah, for giving up their daddy for many weekends and
nights. Each of you did your best to remind me of how important it is
to spend quality time with family, despite the many demands of
authorship.
— BRT
First, I would like to thank Brian for considering me talented enough
to be a contributing author and my poor judgment that made me
agree to his request. When Brian approached me with this idea, I had
just been married for a month to my wonderful and naïve wife,
Karen, and was about to start my Executive MBA from Duke, for
which I had to fly from Florida to Raleigh every other weekend. My
mind envisioned mansions and big boats following the success of this
xxii
Acknowledgments
book. After talking to the publisher, I realized that we will not be
anywhere close to buying a boat. We will be lucky to be able to buy a
life jacket with the new riches. By that time, it was too late to say no.
I would like to thank Karen for supporting me, at least outwardly,
throughout this madness; my parents, for giving me the freedom and

courage to make insane decisions and for constantly reminding me
that I am the cutest kid in the world and thus stroking my fragile ego;
and my failed stand-up comedy career, which forced me to continue
my career as a Sybase DBA for the past decade.
—NA
First, I would like to thank Brian for taking on this initiative and con
-
sidering me to be an author in developing this work. Second, I would
like to thank the other authors for the time and patience that each of
you have shown during this process. As difficult as it is for one per-
son to produce such a work, four people can make it even more
strenuous. Thank you, guys, for keeping the process lighthearted and
fun. It was a pleasure working with you. I would like to thank my
parents, Charlie and Betty, for instilling in me the desire and pride to
do the best I can in whatever I attempt. And most importantly, I
would like to thank my best friend for all of her support during this
time — my wife and my love, Carol.
— SWB
I would like to recognize my co-authors Brian, Naresh, and Steve.
You guys rock. Special thanks go to Carol and Karen for sacrificing
your family time so we could complete this book. I’d like to
acknowledge my dad (posthumously), my mom, and my siblings
(“The Chills”…eyes loaf) for making me the person I am today.
Without them, I might have turned out ordinary. A special thanks to
my friends Linda, Katrina, Colleen, Gina, Heather, Chris, Daryl,
Terri, Allie, and September for providing so much fun and inspiration
during this process. Most importantly, I’d like to thank my husband,
Brian, and wonderful sons, Elliot and Jonah. You are the lights of my
life. I love you more, more, more, more, more!
— CKT

Acknowledgments
xxiii
This page intentionally left blank.

×