Hi, I am a PC programmer so pardon my lack of DB2/AS400 knowledge - I'm trying to learn. I am currently trying to increase the performance of a client/server application we have written in Delphi and running queries against the DB2 tables on our iSeries.
An example of a query used by the program:
select * from CVB7CPL2 where (V7BKSV<>'AC') AND (V7BMSV='N') and (V7CVSV='C') order by V7AINB
I have done some reading and the query is now:
select ABCDE, ..., FGHIH from CVB7CPL2 where (V7BKSV<>'AC') AND (V7BMSV='N') and (V7CVSV='C') order by V7AINB for read only
My main query is regarding indexes, the table CVB7CPL2 is actually a 'logical' table (I assume that's an index) of the physical table CVB7CPP. But this doesn't include the other fields that are in the WHERE clause. Would it be better to query against the physical table and create an index that encompasses all the fields in the where conditions. Or an index for each field used in the where conditions (sometimes it will run with more conditions).
If I query the logical does this means that the DB2 Optimizer will be cut out of the equation?
Any information/handy hints would be gratefully received.
An example of a query used by the program:
select * from CVB7CPL2 where (V7BKSV<>'AC') AND (V7BMSV='N') and (V7CVSV='C') order by V7AINB
I have done some reading and the query is now:
select ABCDE, ..., FGHIH from CVB7CPL2 where (V7BKSV<>'AC') AND (V7BMSV='N') and (V7CVSV='C') order by V7AINB for read only
My main query is regarding indexes, the table CVB7CPL2 is actually a 'logical' table (I assume that's an index) of the physical table CVB7CPP. But this doesn't include the other fields that are in the WHERE clause. Would it be better to query against the physical table and create an index that encompasses all the fields in the where conditions. Or an index for each field used in the where conditions (sometimes it will run with more conditions).
If I query the logical does this means that the DB2 Optimizer will be cut out of the equation?
Any information/handy hints would be gratefully received.