× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Thanks for the great info, Birgitta.

Looking at my table through Navigator, I checked PROPERTIES -> INDEXES,
and there is NOTHING listed in the box.  However, when I check the
source files, there are several fields that are keyed.

I'm confused now...I always thought that when you keyed a file, it would
automatically become it's index.  Is that not the case?

When I look at our directory structures in Navigator, I see there are a
few indexes set up for physical files (listed as an INDEX), and logical
files (listed as VIEWS).

I just tried to set up an index on the pf using plcd/ptno/ptcl/ivchk as
the fields in the index.  When I reran the query, it didn't appear to do
much for performance.

Thanks,

Brian.

-----Original Message-----
From: Hauser, Birgitta [mailto:Birgitta.Hauser@xxxxxxxxxxx] 
Sent: Wednesday, July 20, 2005 9:51 AM
To: 'rpg400-l@xxxxxxxxxxxx'
Subject: RE: DB2 SQL View Resources

>>Can someone point me to some resources that explain on how to create
>>views in DB2 and how to call them from RPG?
 
CREATE VIEW MySchema/MyView
    As Select Field1, Field2, ... FieldN
         From MySchema/MyFile
         Where IVCHK in (3, 5)
 
An SQL-View can be used in RPG like a logical file, but be aware, a view
never has a key.
If you need a predefined sequence, you have to use embedded SQL and add
an
ORDER BY clause in your SELECT statement.
 
>>I'm still wrestling with this problem I had yesterday about retrieving
>>info.  Currently, the table is sitting at 2.9 Million records.
However,
>>within the records, there are only 218,000 that I need (I only need
>>records with an IVCHK status of 3 or 5).  I tried creating a LF only
>>using these records, but it was still slow.
 
>>Would creating a view based on a set of criteria speed up my process?
 
Creating a view will only speed up your process, if you have created the
right indexes.
 
The easiest way would be, to use iSeries Navigator.
Start iSeries Navigator, select database, select the library you need,
execute a SQL script.
Within SQL script you have a wizart for visual explain.
Execute your SQL statement interactively and analyze it with visual
explain.
There is also a Index advisor, that will show you which index should be
created.

 

Birgitta

 


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.