[Chicago-talk] core dump using DBI

Steven Lembark lembark at wrkhors.com
Tue Jul 15 13:46:46 PDT 2008

> the tables.  I am sure I could overcome that with more syntax in the
> select, but decided the SELECT * in a foreach was less error prone.

Catch is that you move a whole lot of data out
of the database that you don't need to. The
added overhead shows up in convering all of
the numeric content to ascii and constructing
the hash/arrayref's required to house the stuff
in perl. All told, if the subset of data is
small (which seems to be the case here) then
you are probably better off joining the tables.

Alias the tables in your select if you don't want
to spell them out:

             a.foo,      # take foo from a (sometable)
             b.bar,      # take bar from b (othertable)
             bletch      # bletch is unique between tables
             sometable   a,
             othertable  b
             a.join_field = b.join_field

My habit is to alias the tables to a, b, c, etc.

You can also use join syntax:

             sometable a join othertable b
             on a.field = b.field

which has benefits if there are more than two
tables (or if you want an outer join).

More information about the Chicago-talk mailing list