Well, you should be using a wrapper around your DB library class already
right? Like you don't use PEAR:DB directly, you have a wrapper class to
handle making a connection, doing the query, handling the error, etc.
Otherwise you're wasting a LOT of code/time. Not to mention it makes it
trivial to swap out the calls to another database library without chaning
all of YOUR code.
So all I did is wedge a logger/profiler into my sql_query() routine. This
has various levels of logging and saving the start/end times, etc.
> -----Original Message-----
> From: vegivamp@stripped [mailto:vegivamp@stripped] On
> Behalf Of Johan De Meersman
> Sent: Tuesday, July 13, 2010 1:17 AM
> To: Daevid Vincent
> Cc: Machiel Richards; mysql@stripped
> Subject: Re: finding exact query being run
>
> Which will still not be particularly helpful for subsecond queries :-)
>
> Either turn on the full query log (beware of I/O
> implications, use separate
> spindles if possible) or use mk-query-analyzer with tcpdump
> to get a running
> analysis of what passes the line.
>
> The addition of tcpdump support is my all-time favourite
> feature of maatkit
> :-D
>
>
> On Tue, Jul 13, 2010 at 12:05 AM, Daevid Vincent
> <daevid@stripped> wrote:
>
> > get "mytop"
> >
> >
> > _____
> >
> > From: Machiel Richards [mailto:machielr@stripped]
> > Sent: Monday, July 12, 2010 8:40 AM
> > To: mysql@stripped
> > Subject: finding exact query being run
> >
> >
> >
> > Hi All
> >
> >
> >
> > I am trying to find out how to see the exact
> query being
> > run.
> >
> >
> >
> > When running show processlit, I get a lot of
> processes that
> > have been running for a VERY long time.
> >
> >
> >
> > I a trying to find out exactly what query it
> is that is
> > being run , any ideas?
> >
> >
> >
> > I tried the slow query log but it is not
> showing up in
> > there.
> >
> >
> >
> > All the queries are showing "sleep"
> >
> >
> >
> > Not sure if this means anything....
> >
> >
> >
> > Machiel Richards
> >
> > MySQL DBA
> >
> > Relational Database Consulting
> >
> >
> >
> > RDC_Logo
> >
> >
> >
> >
>
>
> --
> Bier met grenadyn
> Is als mosterd by den wyn
> Sy die't drinkt, is eene kwezel
> Hy die't drinkt, is ras een ezel
>