Hi,
1) I have 5 huge tables with disjoi1nt data columns except the PI and date column.I need to merge the data into one table so that, one row per account(PI) is created with individual data columns from the 5 tables. The accts may or maynot match between the tables. How do I do this without performance issues? LEFT JOIN?
2) I have a one-rowed table which has NUPI of run-date. Some data tables have acct-key as UPI and run-date as PPI.But some data tables have neither acct-key nor run-date columns. I might have to build join across tables-with-columns, tables-without-those-columns and the one-row table to evaluate data in CASE statements. EXPLAIN shows product join and is badly skewed. How can I rewrite this better?
Ex: T1(huge table with columns)
T2(huge table without columns)
SR(single row table)
sel
Sum(case
when T1.t1 = 'X' and
SR.code = ' ' and
T2.t2 = 'Y'
then 'GOOD ACCT'
end) as qualified_acct
from
T1, T2, SR
where
T1.acct-key = T2.acct-key and
T1.run-date = SR.run-date;
1) I have 5 huge tables with disjoi1nt data columns except the PI and date column.I need to merge the data into one table so that, one row per account(PI) is created with individual data columns from the 5 tables. The accts may or maynot match between the tables. How do I do this without performance issues? LEFT JOIN?
2) I have a one-rowed table which has NUPI of run-date. Some data tables have acct-key as UPI and run-date as PPI.But some data tables have neither acct-key nor run-date columns. I might have to build join across tables-with-columns, tables-without-those-columns and the one-row table to evaluate data in CASE statements. EXPLAIN shows product join and is badly skewed. How can I rewrite this better?
Ex: T1(huge table with columns)
T2(huge table without columns)
SR(single row table)
sel
Sum(case
when T1.t1 = 'X' and
SR.code = ' ' and
T2.t2 = 'Y'
then 'GOOD ACCT'
end) as qualified_acct
from
T1, T2, SR
where
T1.acct-key = T2.acct-key and
T1.run-date = SR.run-date;