Question

UPDATE statement

Rating6.8Good

I need to update large amount of data into my Oracle database. But it take two day to finish updating 1/20 of the data. By establishment, it will take a whole month to finish updata. I could not wait this long. I had tried my best to optimaize my code and I had added Index to improve speed. PLEASE HELP!!!! (I use perl DBI::Oracle).

CODE:


$sth1=$dbh1->prepare("SELECT PDB_AA_num, residue, alignment_num, syn_AA_num, ".
                " swissprot_serial_ID FROM ID_EMBL_SWISSPROT WHERE PDB_name = ? AND alignment_num = ?;");

$sth2 =$dbh1->prepare("UPDATE ID_EMBL_SWISSPROT SET swissprot_AA_num =  ?".
        " where swissprot_serial_ID = ?;");

#$sth3=$dbh1->prepare("SELECT swissprot_AA_num FROM ID_EMBL_SWISSPROT WHERE PDB_name = ? AND alignment_num = ? AND PDB_AA_num = ? ;");


#Protein table
$sth0=$dbh1->prepare("SELECT swissprot_id, PDB_name, alignment_num, IFIR, ILAS, JFIR, JLAS FROM Alignments;");
$sth0->execute();



#selecting IFIR and JFIR number
while(@aryAlig = $sth0->fetchrow_array()){

        #select from ID_EMBL of the corresponding PDB_name and alignment_num
        $sth1->execute($aryAlig[1], $aryAlig[2]);

        #fetching each swissport series
        while(@arySwiss = $sth1->fetchrow_array()){

                my $syn_AA_num = $arySwiss[3];

                if (defined($arySwiss[0])){

                        print "AAnum:$arySwiss[0]\tIFIR:$aryAlig[3]\n";
                        #when PDB_AA_num equal to IFIR
                        if ($arySwiss[0] == $aryAlig[3]){
                                $start = 1;
                                $swissport_num = $aryAlig[5];
                        }

                }
                print "residue:$arySwiss[1]\n";
                if ($start && $arySwiss[1] ne "." && $arySwiss[1] ne "" && $arySwiss[1] ne " "){

                        $sth2->execute($swissport_num, $arySwiss[4]);
                        $swissport_num++;
                }


        }

}


$dbh1->disconnect()
        or warn "Disconnect failed: $DBI::errstr";
exit();

See More

Solution

Sign up now to view this solution! It's quick, easy, and secure to subscribe. We will return you to this solution, unlocked, when you’re done.

About this Solution
View This Solution - Start Your 30 Day Free Trial
Zone
General
Tags
oracle update optimaize statement
Participating Experts
6
Solution Grade
A

Replies

 
by: ser6398

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: Wadhwa

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: FBIAGENT

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: kuichan

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: FBIAGENT

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: Wadhwa

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by:

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: ddandekar

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: Wadhwa

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: Moondancer

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: jtrifts

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: Moondancer

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

Stay Connected

Oracle Around the Web

The latest Oracle news, tips, and tricks

Oracle Unveils Netra SPARC T3 Servers

New Carrier-Grade Blade and Rackmount Servers Deliver Better Performance, Density and Power Efficiency for the Communications Industry ...

read more

Oracle fixes 21 flaws in Java SE, Java for Business

Oracle is fixing 21 flaws in its Java SE and Java for Business products in its February critical patch update issued this week ...

read more

Obama’s Silicon Valley “Tech Supper”

Why was he there? Who wasn’t invited and why? What did they talk about? Why was he really there? These are the questions being debated ...

read more

Featured Oracle Experts

slightwv

slightwv has answered more than 2,000 Oracle questions and oversees database management within the U.S. Government. Slightwv

sdstuber

A regular presenter at the Collaborate conference, Oracle developer sdstuber is a top expert in PL/SQL and Oracle 9, 10 and 11. sdstuber

Testimonials

What users are saying about our experts

"The Oracle gurus provide answers, solutions and valuable workarounds"

User: schwertner

"Wow! Excellent, valuable explanation. Hats off to you"

User: aseshu70

"Solution worked fantastic and performs excellent! Thanks heaps"

User: klausbrandlhuber

Top Experts

  1. slightwv

    2,000

    0 points yesterday

    Profile

BrowseBecome an Expert