I can tell you from experience that connecting the DBI way is much faster. We have Sybase, and two scripts checking ~1000 documents takes 59.23 using isql from the command line, and take 3:07 using DBI. The basic thing is that you have the disk read overhead.