Your problem is your database structure. Instead of putting things into
500 tables, you should merge them into 1 table.
This is not a perl question, its a database design question.
-alex
On Mon, 13 Aug 2001, Evan Zane Macosko wrote:
> Hi everyone,
>
>
> I am use Perl:DBI to interface to a Postgres database that contains many
> tables with two columns and about 6000 rows. Inside my perl program, i
> need to select one column from each of these 500 tables--as many as 500 at
> once--and the way I'm doing it, it seems to take a lot of time. I was
> wondering if people might be able to offer some alternate code. Below is
> the appropriate snippet from the program I'm writing:
>
>
> my $i = 1;
> my $vector;
> my @matrix;
> while ($i<500) {
> $vector = $dbh->selectcol_arrayref("SELECT induction FROM c$i
> order by orf");
> for (0..$#{$vector}) {
> $matrix[$_]->[$i] = $vector[$_];
> }
> $i++;
> }
>
>
>
>
> Thanks,
> Evan
>
>
>