fhg
Volume 8, Number 14 -- April 9, 2008

SQL Doesn't Like Logical Files

Published: April 9, 2008

by Ted Holt

I had a great time at COMMON last week in Nashville, Tennessee. I saw some old friends and met a lot of nice people. I listened to some great presentations put on by some very intelligent people, and that means I have some new tips that I can pass along to you. Here's a tip from IBM'ers Jarek Miszczyk and Tom McKinley.

Today's tip: Don't put DDS-defined logical file names in your SQL statements.

To understand why, let me give you a little background. When you execute an SQL command, the system determines the best way to carry out your request. That is, you concentrate on the task that needs to be done, and the system figures out how to do your task. Various software components are involved in this process, and for this discussion, you need to know about three of them.

First is the Query Dispatcher, whose job it is to decide which of the two query optimization engines it will call on to optimize and process a query. The second and third software components are the two query engines--the Classic Query Engine (CQE) and the SQL Query Engine (SQE). SQE is newer and better than CQE, but there are certain tasks that it can't carry out.

You can reference four types of files in SQL statements: DDS-defined physical files, DDS-defined logical files, SQL tables, and SQL views. Guess which one of the four SQE can't handle? I hope you guessed DDS-defined logical files, to which I will refer to simply as logical files in the following paragraphs. SQL views and indexes are also implemented as logical files, but they are not applicable to this discussion.

Not using any logical files in an SQL query is no guarantee that SQE will kick in and do the work. In V6R1, there are two other cases that force the CQE to handle a query. CQE continues to handle all non-SQL queries, such as the Open Query File (OPNQRYF) command and Query/400. CQE also handles distributed queries via DB2 Multisystem. In earlier releases, even more work is given to CQE.

If you wish to query a logical file from an SQL statement, consider querying the underlying physical file(s) instead. If the logical file has select/omit criteria, put the criteria in the WHERE clause. Another approach would be to create a view over the physical file and reference that view in your SQL query.




                     Post this story to del.icio.us
               Post this story to Digg
    Post this story to Slashdot


Sponsored By
PRODATA COMPUTER SERVICES

DBU 8.0 is the 'must have' database utility for all System i shops!
DBU "plugs-in" to any Eclipse-based IDE, making it easy for developers
to work in the latest development environment!

DBU / RDB offers DBU access to remote databases like
MySQL, Microsoft SQL Server, Oracle, DB2 and more!

RDB Connect provides full SQL access to remote data
from all System i applications.

Now everything can be real-time!

Order today and SAVE $$$!
800.228.6318

sales@prodatacomputer.com
www.prodatacomputer.com


Senior Technical Editor: Ted Holt
Technical Editors: Howard Arner, Joe Hertvik, Shannon O'Donnell, Kevin Vandever
Contributing Technical Editors: Joel Cochran, Wayne O. Evans, Raymond Everhart,
Bruce Guetzkow, Brian Kelly, Marc Logemann, David Morris
Publisher and Advertising Director: Jenny Thomas
Advertising Sales Representative: Kim Reed
Contact the Editors: To contact anyone on the IT Jungle Team
Go to our contacts page and send us a message.

Sponsored Links

MoshiMoshi:  An Interactive Experience for the System i Community. See Episode 1 now!
Northeast User Groups:  18th Annual Conference, April 14-16, 2008, Sheraton Hotel, Framingham, MA
LANSA:  It's Time for 4 days of education at the LANSA User Conference, May 4 – 7, in Orlando


 

IT Jungle Store Top Book Picks

Easy Steps to Internet Programming for AS/400, iSeries, and System i: List Price, $49.95
Getting Started with PHP for i5/OS: List Price, $59.95
The System i RPG & RPG IV Tutorial and Lab Exercises: List Price, $59.95
The System i Pocket RPG & RPG IV Guide: List Price, $69.95
The iSeries Pocket Database Guide: List Price, $59.00
The iSeries Pocket Developers' Guide: List Price, $59.00
The iSeries Pocket SQL Guide: List Price, $59.00
The iSeries Pocket Query Guide: List Price, $49.00
The iSeries Pocket WebFacing Primer: List Price, $39.00
Migrating to WebSphere Express for iSeries: List Price, $49.00
iSeries Express Web Implementer's Guide: List Price, $59.00
Getting Started with WebSphere Development Studio for iSeries: List Price, $79.95
Getting Started With WebSphere Development Studio Client for iSeries: List Price, $89.00
Getting Started with WebSphere Express for iSeries: List Price, $49.00
WebFacing Application Design and Development Guide: List Price, $55.00
Can the AS/400 Survive IBM?: List Price, $49.00
The All-Everything Machine: List Price, $29.95
Chip Wars: List Price, $29.95


 
The Four Hundred
It's Official: Now We're Power Systems and i for Business

Power6 Chips Get i Support in New Entry and Blade Machines

We're Listening About and Acting For the i Platform, Says IBM

Mad Dog 21/21: Bears' Turns

Goodbye, AS/400, Old Friend

The Linux Beacon
Oracle Touts Unbreakable Linux, Adds Clusterware Support

Ubuntu 6.10 Comes to the End of the Line

IBM Merges System p and System i Server Lines

IBM Launches Dual-Core Power6 JS12 Blade Server

Most CIOs Say 2008 IT Budgets Are Stable, So Far

Four Hundred Stuff
Coglin Mill Debuts Lower Cost Versions of ETL Tools

Profound Ships New Web-Based DB2/400 Editor

Linoma Unveils Browser-Based Data Transfer Tool

RJS Adds Document Capture, Packaging Offerings to WebDocs

Readers Respond to "IBM Changes Name Back to AS/400 . . ."

Big Iron
Bears' Turns

Top Mainframe Stories From Around the Web

Chats, Webinars, Seminars, Shows, and Other Happenings

System i PTF Guide
April 5, 2008: Volume 10, Number 14

March 29, 2008: Volume 10, Number 13

March 22, 2008: Volume 10, Number 12

March 15, 2008: Volume 10, Number 11

March 8, 2008: Volume 10, Number 10

March 1, 2008: Volume 10, Number 9

The Windows Observer
Open XML Gets ISO Approval to Become a Standard

HP Targets SMB Shops with New Entry Servers

Windows Mobile Learns from iPhone with Version 6.1

Microsoft Won't Raise Its Yahoo Offer

CMDB: A Journey, Not a Destination

The Unix Guardian
Yen Steps Down as Microelectronics Head, Exits Sun

Sun Bags $44.3 Million DARPA Contract for Funky Chip Interconnect

Disk Array Capacity and Sales Still Growing at Historical Rates

CMDB: A Journey, Not a Destination

Dell Inks OEM Deal with Egenera for Server Management Software

Four Hundred Monitor
Four Hundred Monitor's
Full iSeries Events Calendar

THIS ISSUE SPONSORED BY:

ProData Computer Services
WorksRight Software
Guild Companies


Printer Friendly Version


TABLE OF CONTENTS
SQL Doesn't Like Logical Files

Performance Advice from a Mysterious Friend, Part 4

Admin Alert: V6R1 Changes for the i5/OS Administrator, Part 1

Four Hundred Guru

BACK ISSUES

From the IT Jungle Forums
Al Barsa passed away

Copying recs from a subfile to a file and keeping highlights

Imbedded SQL

CPYFRMSTMF problem

CPYTOIMPF problem

Table Transferfrom OS400 to Windows





 
Subscription Information:
You can unsubscribe, change your email address, or sign up for any of IT Jungle's free e-newsletters through our Web site at http://www.itjungle.com/sub/subscribe.html.

Copyright © 1996-2008 Guild Companies, Inc. All Rights Reserved.
Guild Companies, Inc., 50 Park Terrace East, Suite 8F, New York, NY 10034

Privacy Statement