joec_ has asked for the wisdom of the Perl Monks concerning the following question:
I have some code which should return ~5000 rows (2 columns) (as a reference to an array) from an Oracle database. To execute this PLSQL query takes ~1 second in TOAD or SQLDeveloper however in Perl, using the DBI and DBD::Oracle drivers, it takes just over half an hour. As far as I know, bind_columns is the most efficient way of retrieving data, but maybe you guys could suggest other ideas?
my $plsql=<<ENDPLSQL; DECLARE l_header pacProject.data_header_cur; l_data pacProject.data_cur; l_project_id NUMBER; l_design_set_id NUMBER; l_layout_id NUMBER; BEGIN l_design_set_id := NULL; l_layout_id := 1; pacProject.get_data( :l_project_id, l_design_set_id, l_layout_id, l_header, :l_data); END; ENDPLSQL my $sth_ideas = $dbh_ideas->prepare($plsql); my $sth2; my @row; $sth_ideas->bind_param(":l_project_id",$self->{project_id}); $sth_ideas->bind_param_inout(":l_data",\$sth2,0,{ora_type => ORA_R +SET}); $sth_ideas->execute; my $raRow; my $raResults = []; my ($id, $valreal, $valtext, $colorder); $sth2->bind_columns(\($id, $valreal, $valtext, $colorder)); while( $sth2->fetch ) { push @$raResults, [ $id,$valtext ]; } return $raResults;
Thanks.
Joe.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: DBI Queries take half an hour
by mje (Curate) on Dec 16, 2008 at 10:53 UTC | |
by joec_ (Scribe) on Dec 16, 2008 at 11:00 UTC | |
by marto (Cardinal) on Dec 16, 2008 at 11:03 UTC | |
|
Re: DBI Queries take half an hour
by tirwhan (Abbot) on Dec 16, 2008 at 10:59 UTC | |
by joec_ (Scribe) on Dec 16, 2008 at 11:23 UTC | |
by runrig (Abbot) on Dec 16, 2008 at 20:33 UTC | |
|
Re: DBI Queries take half an hour
by moritz (Cardinal) on Dec 16, 2008 at 10:47 UTC | |
|
latency and round-trips
by tallfred (Acolyte) on Dec 16, 2008 at 20:56 UTC | |
by Anonymous Monk on Dec 17, 2008 at 09:23 UTC | |
by joec_ (Scribe) on Dec 17, 2008 at 09:31 UTC | |
by Corion (Patriarch) on Dec 17, 2008 at 10:07 UTC | |
by techcode (Hermit) on Dec 17, 2008 at 13:07 UTC | |
by joec_ (Scribe) on Dec 17, 2008 at 14:25 UTC | |
| |
by pajout (Curate) on Dec 17, 2008 at 15:38 UTC | |
by joec_ (Scribe) on Dec 17, 2008 at 23:55 UTC | |
| |
|
Re: DBI Queries take half an hour
by Anonymous Monk on Dec 16, 2008 at 11:53 UTC |