[Israel.pm] patterns findings

Gabor Szabo szabgab at gmail.com
Wed Mar 18 07:40:26 PDT 2009

2009/3/18 Yossi Itzkovich <Yossi.Itzkovich at ecitele.com>:
> Gabor,
> The problem is that I don't know the patterns - I want the script to find.
> Let me explain the need:
> We have a big tracing log of SQL queries to DB. We want to analyze it and find if there are repeating sequences of same  queries, and optimize them (make one big query, or change application code).

Well, if you give a real example instead of an abstract one then you
can get more help.

I guess there are tools out there to analyze such log if that is a standard log.

So you could either show us a few lines of the real log file or tell
us what tool
produced it. Is it the logging message of DBI ?

If you really have no clue of what a repeating string can look like
then just go with
if ($str =~ /(.+).*\1/) {
    print $1;

or better yet tell the thing you want the repeating string to be at
least 10 characters long:

if ($str =~ /(.{10,}).*\1/) {
    print $1;


More information about the Perl mailing list