On Sat, 30 Jun 2001, Orlando Andico wrote:

>
> Hello all,
>
> I have a major Perl program which does a lot of SQL queries. In the past I
> would time each query using Time::HiRes like this:
>
> $t0 = [gettimeofday];
> # do SQL query and stuff
> $t = [gettimeofday] - $t0;
> print "DEBUG: time elapsed is $t\n";
>
> The issue is,
>
>  1) I just rewrote the guts of this program because we did a major
>     redesign on our schema
>
>  2) the program is unacceptably slow now
>
> I don't want to insert Time::HiRes instrumenting code all over the place
> again. Unfortunately, Devel::DProf doesn't give me line-by-line execution
> time breakdowns, and Devel::SmallProf has a clash somewhere with
> DBD::Oracle so running my program with -d:SmallProf causes it to crash.
>
> Are there any other ways I can profile my program to determine which SQL
> queries need to be optimized? I did a quick-and-dirty of the SQL, and I'm
> in no mood to optimize them all.

I'd say put a layer of indirection by creating a perl module that mirrors
the API of DBI, and put in your benchmarking code there.  If you designed
the app well, you wouldve isolated all DB specific code into a module (no
dbi statements scattered in the code) which would allow you to
non-intrusively do something like this...



_
Philippine Linux Users Group. Web site and archives at http://plug.linux.org.ph
To leave: send "unsubscribe" in the body to [EMAIL PROTECTED]

To subscribe to the Linux Newbies' List: send "subscribe" in the body to 
[EMAIL PROTECTED]

Reply via email to