Presentation is loading. Please wait.

Presentation is loading. Please wait.

ASE Optdiag Features including dynamic_histogram

Similar presentations


Presentation on theme: "ASE Optdiag Features including dynamic_histogram"— Presentation transcript:

1 ASE Optdiag Features including dynamic_histogram
ASE Customer Coffee Corner Sept, 2016

2 Agenda What is optdiag ? Using simulated statistics for an SAP incident Syntax for optdiag Other tools related to optdiag What is new with statistics in ASE 16 SP 01? Document Links Live Demo

3 What is optdiag? The optdiag utility displays statistics from the systabstats and sysstatistics tables. It can be used to update sysstatistics information. Only a system administrator can run optdiag. Using optdiag to alter statistics can improve the performance of some queries. Note: optdiag overwrites existing information in the system tables, which can affect all queries for a given table. After you change statistics using optdiag: running create index or update statistics overwrites the changes. The commands succeed,  but prints a warning message like: WARNING: Edited statistics are overwritten. Table: ’titles’ (objectid ), column: ’type’.

4 What is optdiag? (CONTINUED)
If you load statistics without simulate mode, be prepared to restore the statistics, if necessary, either by using an untouched copy of optdiag output or by re-running update statistics. You can use optdiag output from a 32-bit SAP ASE to change statistics in another 32-bit SAP ASE, but not a 64-bit SAP ASE. Similarly, do not use optdiag output from a 64-bit SAP ASE as input to a 32-bit SAP ASE.

5 Using simulated statistics for an SAP incident
When sending a query performance incident to SAP generally you are requested to send: “simulate statistics” along with complete ddls for all tables in the query ddl’s include: tables, indexes, partitions, and named caches. optdiag can generate statistics that can be used to simulate a user environment without requiring a copy of the table data. This permits analysis of query optimization using a very small, or empty database. For example, you can use simulated statistics to: Help Technical Support replicate optimizer problems Perform “what-if” analyses to plan configuration changes Perform diagnostics on a development server. You can also load simulated statistics into the database from which they were copied. Simulated statistics are loaded into the system tables with IDs that distinguish them from actual table data. The ’set statistics simulate on’ command instructs the server to optimize queries using the simulated statistics, rather than the actual statistics.

6 Syntax optdiag? The syntax for optdiag is: optdiag [binary] [simulate] statistics {-i <input_file> | <database>[.<owner>[.<table>[.<partition> [.<column>]]]] [-o <output_file>]} [-U <user_name>] [-P <password>] [-I <interfaces_file>] [-S <server>] [-v] [-h] [-s] [-T <flag_value>] [-z <language>] [-J <client_charset>] [-a <display_charset>] [using dynamic_histogram [ on | off ] To display statistics for all user tables in the pubs2 database, placing the output in the pubs2.opt file, use: optdiag simulate statistics pubs2 -Usa -Ppasswd -o pubs2.opt To display statistics for the titles table and for any indexes on the table, use: optdiag simulate statistics pubs2..titles -Usa -Ppasswd -o AAAI.opt

7 Other tools related to optdiag
sp_showoptstats SAP ASE includes sp_showoptstats, which functions like the optdiag standalone utility, extracting and showing, in an XML document, statistics and histograms for various types of data objects from system tables such as systabstats and sysstatistics. The syntax is: sp_showoptstats [<dbname>[.<owner>[.[<table_name>] ] ] ], [.<column>], [<option>]

8 Other tools related to optdiag (continued)
sp_flushstats sp_flushstats explicitly flushes the in-memory statistics for a specific table to systabstats (these statistics are things like the row count, cluster ratio information, etc.; not the histogram & density information generated by  update statistics). This flushing is normally done automatically by the housekeeper task, but in case the housekeeper is disabled, you can force the data to be flushed. Use sp_flushstats first to ensure that the most recent statistics are available. optdiag flushes statistics to disk before displaying values. sp_modifystats sp_modifystats allows you to manipulate the density statistics in sysstatistics, which were generated by update statistics.  Using this procedure makes sense only when you have a very good understanding of the ins and outs of the ASE query optimizer.

9 What is new with statistics in ASE 16 SP 01?
Dynamic histograms: Dynamic histograms allow you to specify columns for which a new range cell is dynamically maintained at the end of an existing histogram. For DML operations on this column, the new range cell includes the maximum value and dynamically maintains a row count. The boundaries of the original cells of the histogram remain unchanged, but the weights of the original cells are proportionally decreased as the weight of the new cell is increased. The syntax to enable dynamic histograms is: update statistics <table_name> (<column_name>, ...) ... [using dynamic_histogram [ on | off ]

10 What is new with statistics in ASE 16 SP 01? (continued)
You must set the configuration for “sysstatistics flush interval” to a value greater than zero sp_configure “sysstatistics flush interval”, 20 The default is zero Traceflag for example: dbcc traceon (3604, 12806) Print diagnostic trace on UPDATE STATISTICS and DML commands.

11 Document Links References:
Performance is slow for a query using in-between statement (range predicate) – ASE How to determine if REORG should be run from optdiag output in ASE? Table scan is chosen if local variable is used as a search argument and the query performance slows down. - SAP ASE How to collect diagnostic information for a query performance problem for ASE15.0 Documentation: Performance and Tuning Series: Improving Performance with Statistical Analysis Changing Statistics with optdiag Using Simulated Statistics Viewing Statistics and Histograms Using sp_showoptstats optdiag Syntax for Simulated Statistics Using Dynamic Histograms

12 Live Demo

13 Thank you Feel free to email questions, ideas, or comments to:

14

15

16 Preparing Your Slides Let visuals guide your audience. Avoid writing script on the slide. Check spelling with Presentation Wizard Presentation duration? 1 hour or less, no more than 30 slides. 10 Font size of at least 10 An agenda is required

17 Speaking Tips Don’t read straight from your notes!
Pronounce your words as clearly as possible Non-native listeners will appreciate it!

18 Prepping the Deck – Writing Style
Words in English are typically written lowercase. Exceptions: headlines, nations, names of places … Your text should be short and digestible. Use only SAP approved names, and use the full term when first mentioned. After having already mentioned the entire name, you may abbreviate. “SAPanese” also requires explanation.


Download ppt "ASE Optdiag Features including dynamic_histogram"

Similar presentations


Ads by Google