SAS temporary DB2 tables - Creating an index -


i have not found clear answer dba's on one. in db2 warehouse...huge tables. practice temp tables rsubmit, such as...

execute (declare global temporary table session.tmp1(task char(9))on commit preserve rows not logged) db2; execute (create unique index session.indexa on session.tmp1(task)) db2; insert session.tmp1 select * connection db2  ( select   distinct a.column     table1    ... fetch ur ); 

then when need specific group of values, join it...

from session.tmp1 t inner join tablex x on t.task = x.task 

you notice declared index (a unique index even). question is...if index not exist on original db2 table using build temp table...will created index matter? in addition, sr. analyst advised me if "order by" attribute/column indexing when build temp table, speed join when use additional tables. can confirm of these questions? may seem trivial...but looking tips on speed, when tables hitting extremely large...

sr. analyst "order by" remark:

it depends on scenario:

if during creation of tmp table no order used in plan @ all, , in following join query plan not show need order data, time order data in tmp table larger time saved in join.

if in join data ordered before joining, adding order might increase speed of step (the plan still show ordering of data since not know data ordered), time gained @ maximum equal time lost when ordering tmp table. when use tmp table more once, might save time. use once, , pretty useless.

the index created:

the index later joins/where conditions on tmp table. if using indexed columns in join or where: go it.

one exception on is: when join data in table, index not beneficial. might ignored (see plan again), or might slow down when used. highly dbms dependent: oracle: full table scan of time quicker when joining rows, mysql/mariadb: full joins, adding index saves hours, sql server determines pretty (usually uses index), db2: please post here once determined this.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -