Writing a pretty heavy query, trying to limit data base on coniditions.
Three table join on multiple columns all part of primary key.
tables are 1 - common table, 2 - line table, 3 - temp table created in previous sql which consits only of all primary keys of items we want from common and line tables
so outline:
select common.values, line.values from
temp table, common.table, line.table
where
temp table.primary key = common table.primary key and
common table.primary key = line table. primary key
the key is made up of 5 columns.
when we join the common to the line the data is back in a flash, however, it returns more data then we will ever need
as soon as we join in the temp table (1/10th the data compared to volume in the common) the query will run forever!!! The main purpose of the temp data is to filter out data we do not need (ie 1/10 of the common table)
right after the temp table is created (previous step) runstats is handled like this
"RUNSTATS ON TABLE DC.TMP_DCS_EXT_2 AND INDEXES ALL SHRLEVEL CHANGE"
tried joining just the common and temp table performance is just as horrible.
any ideas on where to look?