Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 20 Feb 2004 @ 18:10:13 GMT


     
  <Prev Next>  
<<First
<Prev
Next>
Last>>
 


Subj:   Sel on IDCOL,TVM and Dbase tables performance issue
 
From:   Yepuri, Vijay

Hi ,

I have a table with Identity column. after and insert my goal is to get the primary key ( which is the identity colunm). To solve this problem did the following.

SELECT dbc.idcol.availvalue FROM dbc.idcol,dbc.tvm,dbc.dbase
        WHERE   dbc.idcol.tableid = dbc.tvm.tvmid and
        dbc.idcol.databaseid = dbc.dbase.databaseid and
        dbc.dbase.databasenamei = 'dbname' and
        dbc.tvm.tvmnamei = 'processlog';

This Query is taking hell lot of time on our system any idea why?

Is there any other way to accomplish this.

Thanks


Regards

Vijay


logon_file=${1}
processid=${2}
processlogidfile=${4}


bteq << EOT
.run file=${logon_file};

.os del ${processlogidfile};


Database dbname;

BEGIN TRANSACTION;

LOCK TABLE processlog FOR WRITE

.export data file=${processlogidfile}
        SELECT dbc.idcol.availvalue FROM dbc.idcol,dbc.tvm,dbc.dbase
        WHERE   dbc.idcol.tableid = dbc.tvm.tvmid and
        dbc.idcol.databaseid = dbc.dbase.databaseid and
        dbc.dbase.databasenamei = 'dbname' and
        dbc.tvm.tvmnamei = 'processlog';
.export reset;


INSERT INTO PROCESSLOG (ProcessID,StartTime)
VALUES(${processid},CURRENT_TIMESTAMP);

END TRANSACTION;

.logoff
.quit
EOT


     
  <Prev Next>  
<<First
<Prev
Next>
Last>>
 
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 27 Dec 2016