473,503 Members | 2,075 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

single table query multiple indexes

Please can someone help me with the following question.
Using mainframe db2 ie on MVS OS/390 for a select against a single
table will db2 use mutiple indexes?

ex:

select *
from table1
where field1 = 'AAA'
and field2 = '222'

assuming there is a seperate index on filed1 and field2 does DB2 have
the capability to use both the field1 and field2 index by searching
through both index and then combining the result of searching both
indexes, rather than using just one of these indexes for one query?
Thank you in advance.

Nov 12 '05 #1
5 3206
<sg*******@sbcglobal.net> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.com...
Please can someone help me with the following question.
Using mainframe db2 ie on MVS OS/390 for a select against a single
table will db2 use mutiple indexes?

ex:

select *
from table1
where field1 = 'AAA'
and field2 = '222'

assuming there is a seperate index on filed1 and field2 does DB2 have
the capability to use both the field1 and field2 index by searching
through both index and then combining the result of searching both
indexes, rather than using just one of these indexes for one query?
Thank you in advance.

Yes it has that capability. But whether it does depends on whether DB2
thinks it is faster to do it that way rather than some other way.
Nov 12 '05 #2
Mark, Thank You,

Please, I have searched IBM.com for info on this question and found
little, if you are aware can you please tell me where ibm may have
documented this capability?

Thanks Again, Stan
Mark A wrote:
<sg*******@sbcglobal.net> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.com...
Please can someone help me with the following question.
Using mainframe db2 ie on MVS OS/390 for a select against a single
table will db2 use mutiple indexes?

ex:

select *
from table1
where field1 = 'AAA'
and field2 = '222'

assuming there is a seperate index on filed1 and field2 does DB2 have the capability to use both the field1 and field2 index by searching
through both index and then combining the result of searching both
indexes, rather than using just one of these indexes for one query?
Thank you in advance.
Yes it has that capability. But whether it does depends on whether

DB2 thinks it is faster to do it that way rather than some other way.


Nov 12 '05 #3
> Mark, Thank You,

Please, I have searched IBM.com for info on this question and found
little, if you are aware can you please tell me where ibm may have
documented this capability?

Thanks Again, Stan

Try the manuals. The Explain facility shows the access path of an SQL
statement and there should be some information about what happens in the
explain output (rows in the PLAN_TABLE) if multiple indexes are used on one
table.

Using the explain is the only way you can know for sure if DB2 will use both
indexes for a particular query, even if DB2 is capable of doing so. Make
sure you first do a table reorg and then run runstats utility and ask for
detailed specifications. Then do the explain.
Nov 12 '05 #4
> > Please, I have searched IBM.com for info on this question and found
little, if you are aware can you please tell me where ibm may have
documented this capability?

Thanks Again, Stan
Try the manuals. The Explain facility shows the access path of an SQL
statement and there should be some information about what happens in the
explain output (rows in the PLAN_TABLE) if multiple indexes are used on

one table.

Using the explain is the only way you can know for sure if DB2 will use both indexes for a particular query, even if DB2 is capable of doing so. Make
sure you first do a table reorg and then run runstats utility and ask for
detailed specifications. Then do the explain.

I found it for you. In the PLAN_TABLE (updated when you do an explain),
there is column called ACCESSTYPE. Here the values of ACCESSTYPE that
pertain to multiple index access on a single table:

Value Meaning
--- ------------------------------------------
M - Start of multiple index access processing
MX - Indexes are to be scanned for later union or intersection
MI - An intersection (AND) is performed
MU - A union (OR) is performed
Nov 12 '05 #5
Mark,

This does help, I will persue using the advise you have given.
I Wish you luck, Stan

Nov 12 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
130041
by: Michael | last post by:
I have two tables with a 1-many relationship. I want to write a select statement that looks in the table w/many records and compares it to the records in the primary table to see if there are any...
2
3310
by: Roy Padgett | last post by:
I have a combo box where users select the customer name and can either go to the customer's info or open a list of the customer's orders. The RowSource for the combo box was a simple pass-through...
9
2749
by: Ed_No_Spam_Please_Weber | last post by:
Hello All & Thanks in advance for your help! Background: 1) tblT_Documents is the primary parent transaction table that has 10 fields and about 250,000 rows 2) There are 9 child tables with...
8
3224
by: Együd Csaba | last post by:
Hi All, how can I improve the query performance in the following situation: I have a big (4.5+ million rows) table. One query takes approx. 9 sec to finish resulting ~10000 rows. But if I run...
3
2241
by: Paul Janssen | last post by:
Hello! Can anyone help me out with the following situation: (a) a single query with 550 id's in the IN-clause resulting into 800+ seconds; (b) 550 queries with a single id in the IN-clause...
5
3306
by: Ross A. Finlayson | last post by:
Hi, I'm scratching together an Access database. The development box is Office 95, the deployment box Office 2003. So anyways I am griping about forms and global variables. Say for example...
0
2200
by: rayone | last post by:
Hi folks. I need advice. 2 options, which do you think is the better option to display/retrieve/report on the data. Keep in mind reporting (Crystal), SQL Performance, VB Code, usability,...
1
3417
by: B | last post by:
Hello All, This is my first time using this list, but hopefully I got the right one for the question I need to ask :). I have a table which has about 4 million records. When I do a search...
0
8031
bilibytes
by: bilibytes | last post by:
hi, i am trying to UPDATE multiple rows with mysql. I know how to do it with multiple queries but i think it would be less resource consuming generating mysql query code with php and update all...
0
7193
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7264
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7316
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5562
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3160
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3148
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1495
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
728
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.