× 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.



Had to lookup what an "MTI" was. Found a reference to Maintained
Temporary Indexes here:
http://archive.midrange.com/midrange-l/200703/msg01182.html

I am not sure what spawns their (MTI) creation. So I can't answer your
second question.

A permanent index should be used right away and not have to wait for IPL.

Here's your proof:

I created a procedure by running RUNSQLSTM against this source member:
***** Start of source
CREATE PROCEDURE ROB.TEST
LANGUAGE SQL
BEGIN

DECLARE COUNTER INT DEFAULT 0;

CREATE TABLE ROB.BISMUTH (MYKEY INT , THENBR DEC (15 , 5));

WHILE COUNTER < 10000 DO
INSERT INTO ROB.BISMUTH (THENBR) VALUES(rand(1)*100);
SET COUNTER = COUNTER + 1;
END WHILE;

create table rob.bismuth1 as
(select * from rob.bismuth
order by mykey)
with data;

create table rob.bismuth2 as
(select * from rob.bismuth
order by thenbr)
with data;

CREATE INDEX ROB.bismutha ON ROB.BISMUTH (MYKEY ASC);

CREATE INDEX ROB.bismuthb ON ROB.BISMUTH (thenbr ASC);

create table rob.bismuth3 as
(select * from rob.bismuth
order by mykey)
with data;

create table rob.bismuth4 as
(select * from rob.bismuth
order by thenbr)
with data;

END
***** End of source

Then I went into Run SQL Scripts and ran it by CALL ROB.TEST;
When it created table 1 and 2 it advised the indexes later created. When
it created 3 and 4 it did not call for any indexes.

Granted, it didn't use them, all four tables used full table scans
(according to VE).

I modified the source to the following:
***** Start of modification
create table rob.bismuth1 as
(select mykey, thenbr from rob.bismuth
order by mykey)
with data;

create table rob.bismuth2 as
(select mykey, thenbr from rob.bismuth
order by thenbr)
with data;

CREATE INDEX ROB.bismutha ON ROB.BISMUTH (MYKEY ASC, THENBR ASC);

CREATE INDEX ROB.bismuthb ON ROB.BISMUTH (thenbr ASC, MYKEY ASC);

create table rob.bismuth3 as
(select mykey, thenbr from rob.bismuth
order by mykey)
with data;

create table rob.bismuth4 as
(select mykey, thenbr from rob.bismuth
order by thenbr)
with data;
***** End of modification

Cut a few milliseconds off. Table 3 and 4 were built with only an index
scan, and no table scan. Why? Because all columns needed in the select
were already in the index. Thus bypass the table completely.


Rob Berendt

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.