Showing posts with label SQL. Show all posts
Showing posts with label SQL. Show all posts

Sunday, September 20, 2009

Using Reserved Words in as400 sql queries

If your trying to run an SQL statement on the as400, but are getting errors because one of your column names is an DB2/400 SQL reserved word, try the following.

Wrap double quotes around the offending column name, and also make it uppercase. This should resolve the reserved words problem!

Friday, July 24, 2009

OnDemand SQL Performance Analysis Simplified on DB2 for i5/OS in V5R4

The goal of database performance tuning is to minimise the response time of your queries. It is also to optimise your servers resources by minimising network traffic, disk IO, and CPU time.
This IBM Redbook helps you to understand the basics of identifying and tuning the performance of Structured Query Language (SQL) statements using IBM DB2 for i5/OS . DB2 for i5/OS provides a comprehensive set of tools that help technical analysts tune SQL queries. The SQL Performance Monitors are part of the set of tools that IBM i5/OS provides for assisting in SQL performance analysis since Version 3 Release 6. These monitors help to analyze database performance problems after SQL requests are run. In V5R4 of i5/OS iSeries Navigator provides a series of new tools to do SQL Performance analysis that we cover in this redbook. Among the new tools that we will covering are:
- Capability of visualizing the contents of the SQE Plan Cache
- SQE Plan Cache Snapshots
- The new reporting tool - Dashboard
- OnDemand Index Advisor
- Evaluators such as Index and Materialized Query Tables
This redbook also presents tips and techniques based on the SQL Performance Monitors and other tools, such as Visual Explain and all the tools provided in V5R4. You’ll find this guidance helpful in gaining the most out of both DB2 for i5/OS and query optimizer when using SQL

Chapter 1. Determining whether you have an SQL performance problem
Chapter 2. DB2 for i5/OS performance basics
Chapter 3. Overview of tools to analyze database performance
Chapter 4. Gathering SQL performance data
Chapter 5. Analyzing SQL performance data using iSeries Navigator
Chapter 6. Custom Database Monitor Analysis
Chapter 7. SQE Plan Cache and SQE Plan Cache Snapshots
Chapter 8. Analyzing database performance data with Visual Explain
Chapter 9. Index Advisor
Chapter 10. SQL Performance Analysis: A Methodology
Chapter 11. Environmental settings that affect SQL Performance
Chapter 12. Tips to pro-actively prevent SQL performance problems
Chapter 13. Using Collection Services data to identify jobs using system resources
Appendix A. Tools to check a performance problem

http://www.redbooks.ibm.com/abstracts/sg247326.html

Saturday, May 09, 2009

The performance difference between a true SQL index on the as400 and a keyed logical index

Apparently there is a huge performance difference on the as400, that has existed since V4R2, between SQL indexes and DDS created logical files. The performance is so much better that it is worth converting all DDS logicals to SQL, even if they are only used by RPG programs

The evolution of the as400 / iSeries / i5 has resulted in a mix of old and new technologies. Most notably
are the methods used to create, populate and manipulate databases. Many iSeries/i5 application
developers have embraced modern tools for creating front end masterpieces to their existing data;
however the underlying foundation, the database itself, has been woefully neglected. Basically
the existing databases were created using a tool known as DDS (Data Description Specification).
All other Relational Database Management Systems (RDMS) use Structured Query Language, or
SQL, to define the database.
For many iSeries/i5 developers initial attempts in the use of SQL have resulted in unacceptable
performance causing system administrators and/or Chief Information Officers to discourage its
use. For others, the ease of use of SQL has made it the preferred tool for data creation and access.
When these two groups come together the result is like a bad beer commercial. Shouts of “It’s
great!” are hurled in response to yells of “Less fulfilling!”
As IBM continues to enhance DB2 UDB for iSeries (e.g. the new and improved SQL Query
Engine, more efficient data access methods, new database primitives, etc) the decision to use
SQL over traditional methods will no longer be if, but when. In fact, many iSeries/i5 shops are
developing all new applications using SQL. In addition, the use of SQL defined databases may
result in improved throughput as a result in changes to the underlying architecture (more on this
later).
So all new SQL development will benefit from new database technology but what about the
existing DDS defined databases that are still serving thousands of applications using Record
Level Access (RLA) methods via High Level Language (HLL) read and write operations? Is there
a way that these applications can take advantage of SQL database enhancements without a total
rewrite?
The answer is a resounding Yes! This is the basic premise of this article. In essence this article
provides a high level overview of the madness behind the methods known as the Stage 1 DDS to
DDL reengineering strategy detailed in the soon to be released Redbook "Modernizing iSeries
Application Data Access - a Roadmap Cornerstone".


Full PDF here -
as400 DDS and SQL Performance

Good luck with your as400 logical file performance

Monday, January 31, 2005

Use as400 SQL views to transfer packed data using FTP

The question of how to transfer packed data from an iSeries to an ASCII system has been asked many times. It has been suggested that one can use a logical file that redefines the packed field as zoned. This works as long as the value is non-negative and the number of decimals is 0 - the decimal point does not get transferred. CPYTOIMPF and CPYFRMIMPF can also be used but require extra steps in the process.

A standard logical file cannot convert numeric data to character, either. But an SQL logical view can use the SQL CHAR function to convert any numeric data to left-justified values that have the sign and the decimal point

http://search400.techtarget.com/tip/1,289483,sid3_gci1044575,00.html

as400 SQL vs. DDS -- The good, the bad and the downright ugly

In case you haven't heard, DDS is no longer the development language of choice when it comes to defining and maintaining your as400 database. It has been usurped by SQL's Data Definition Language (DDL)

http://search400.techtarget.com/tip/1,289483,sid3_gci1021854,00.htm

Monday, January 24, 2005

Use SQL views to transfer packed iseries data using FTP

Use SQL views to transfer packed data using FTP: "A standard logical file cannot convert numeric data to character, either. But a view can use the CHAR function to convert any numeric data to left-justified values that have the sign and the decimal point. "