Re: n+1 is triggering multiple queries, 3?

2005-07-14 Thread Chris Lear
* Larry Meadors wrote (14/07/2005 13:35):
> On 7/14/05, Chris Lear <[EMAIL PROTECTED]> wrote:
>> * Ron Grabowski wrote (14/07/2005 13:18):
>> > The Java version of iBATIS has support for logging all sql sent to
>> > the database. Here's some sample output:
>> >
>> >  http://issues.apache.org/jira/browse/IBATISNET-35
>>
>> That's DEBUG output from the java.sql.PreparedStatement class. It's
>> not quite the same as profiling the actual SQL sent to the
>> database, but it should be pretty close. It's also not coming out
>> of the iBatis classes themselves, which is why you can't get the
>> same thing if you're not using java.  To see this output, you just
>> need to enable DEBUG-level logging (with log4j or whatever).

> Not exactly Chris.
> 
> These come from the PreparedStatementLogProxy class, which is a proxy
> to PreparedStatement that logs to the java.sql.PreparedStatement
> logger.

I stand corrected. Sorry about that.
--
Chris


Re: n+1 is triggering multiple queries, 3?

2005-07-14 Thread Larry Meadors
Not exactly Chris.

These come from the PreparedStatementLogProxy class, which is a proxy
to PreparedStatement that logs to the java.sql.PreparedStatement
logger.

Larry

On 7/14/05, Chris Lear <[EMAIL PROTECTED]> wrote:
> * Ron Grabowski wrote (14/07/2005 13:18):
> > The Java version of iBATIS has support for logging all sql sent to the
> > database. Here's some sample output:
> >
> >  http://issues.apache.org/jira/browse/IBATISNET-35
> 
> That's DEBUG output from the java.sql.PreparedStatement class. It's not
> quite the same as profiling the actual SQL sent to the database, but it
> should be pretty close. It's also not coming out of the iBatis classes
> themselves, which is why you can't get the same thing if you're not
> using java.
> To see this output, you just need to enable DEBUG-level logging (with
> log4j or whatever).
> 
> --
> Chris
>


Re: n+1 is triggering multiple queries, 3?

2005-07-14 Thread Chris Lear
* Ron Grabowski wrote (14/07/2005 13:18):
> The Java version of iBATIS has support for logging all sql sent to the
> database. Here's some sample output:
> 
>  http://issues.apache.org/jira/browse/IBATISNET-35

That's DEBUG output from the java.sql.PreparedStatement class. It's not
quite the same as profiling the actual SQL sent to the database, but it
should be pretty close. It's also not coming out of the iBatis classes
themselves, which is why you can't get the same thing if you're not
using java.
To see this output, you just need to enable DEBUG-level logging (with
log4j or whatever).

--
Chris


Re: n+1 is triggering multiple queries, 3?

2005-07-14 Thread Larry Meadors
p6spy is also a great sql logging tool.

On 7/14/05, Ron Grabowski <[EMAIL PROTECTED]> wrote:
> The Java version of iBATIS has support for logging all sql sent to the
> database. Here's some sample output:
> 
>  http://issues.apache.org/jira/browse/IBATISNET-35
> 
> --- Kris Rasmussen <[EMAIL PROTECTED]> wrote:
> 
> > Thanks Clinton,
> >
> > I will look into this myself when I have more time. I wish there were
> > a MySql Profiler or something so that I could see what queries are
> > actually being executed. Maybe I will step into your code if I get a
> > chance.
> >
> > Kris
> >
> > Clinton Begin <[EMAIL PROTECTED]> wrote:
> > Kris,
> >
> > This is the right list ([EMAIL PROTECTED]).
> >
> > Sorry nobody responded.  I had a quick look when you originally sent
> > it, and I couldn't see how it was possible that the groupBy or a
> > nested resultMap could cause additional queries...
> >
> > Perhaps someone else has thoughts?  If not, you might have to write
> > an isolated unit test and submit it through JIRA.
> >
> > Cheers,
> > Clinton
> >
> >
> > On 7/9/05, Kris Rasmussen <[EMAIL PROTECTED]> wrote:I have an
> > n+1 mapping. When I look at mysql health in the administrator it
> > apears that 3 queries are being executed instead of one. The first
> > query gets executed when I retrieve the intial object via
> > queryForObject. The next two queries are being executed when I
> > attempt to access the List which stores the related objects from the
> > main object. I am very curious what is going on since I don't know
> > how Ibatis could even know what query to execute to get the items
> > later?
> >
> > The following maps are used to retrive a single instance of classB
> > with all of its classA children stored in one of its properties which
> > is of course a list.
> >
> >
> > 
> >
> > ... some basic properties
> >
> > 
> >
> >
> >
> > 
> >
> > 
> >
> > 
> >
> > ... some more properties
> >
> > 
> >
> >
> >
> >  > extends="getClassBResult" groupBy="primKey1,primKey2">
> >
> > 
> >
> > 
> >
> >
> >
> > and my select statement...
> >
> >  > resultMap="getClassBWithClassAsResult">
> >
> > SELECT classB.*,classA.* FROM classB ,classA
> >
> > WHERE classB.primKey1=#primKey1# AND classB.primKey2=#primKey2# AND
> > gallery_image.SiteId=#siteId# AND gallery_image.BlockId=#blockId#
> >
> > GROUP BY classB.primKey1,classB.primKey2,classA.primKey3
> >
> > 
> >
> >
> >
> > __
> > Do You Yahoo!?
> > Tired of spam? Yahoo! Mail has the best spam protection around
> > http://mail.yahoo.com
> >
> >
> >
> >
> > -
> >  Start your day with Yahoo! - make it your home page
> 
>


Re: n+1 is triggering multiple queries, 3?

2005-07-14 Thread Ron Grabowski
The Java version of iBATIS has support for logging all sql sent to the
database. Here's some sample output:

 http://issues.apache.org/jira/browse/IBATISNET-35

--- Kris Rasmussen <[EMAIL PROTECTED]> wrote:

> Thanks Clinton,
>  
> I will look into this myself when I have more time. I wish there were
> a MySql Profiler or something so that I could see what queries are
> actually being executed. Maybe I will step into your code if I get a
> chance.
>  
> Kris
> 
> Clinton Begin <[EMAIL PROTECTED]> wrote:
> Kris,
> 
> This is the right list ([EMAIL PROTECTED]).
> 
> Sorry nobody responded.  I had a quick look when you originally sent
> it, and I couldn't see how it was possible that the groupBy or a
> nested resultMap could cause additional queries...
> 
> Perhaps someone else has thoughts?  If not, you might have to write
> an isolated unit test and submit it through JIRA.
> 
> Cheers,
> Clinton
> 
> 
> On 7/9/05, Kris Rasmussen <[EMAIL PROTECTED]> wrote:I have an
> n+1 mapping. When I look at mysql health in the administrator it
> apears that 3 queries are being executed instead of one. The first
> query gets executed when I retrieve the intial object via
> queryForObject. The next two queries are being executed when I
> attempt to access the List which stores the related objects from the
> main object. I am very curious what is going on since I don't know
> how Ibatis could even know what query to execute to get the items
> later?
>  
> The following maps are used to retrive a single instance of classB
> with all of its classA children stored in one of its properties which
> is of course a list.
>  
> 
> 
> 
> ... some basic properties
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ... some more properties
> 
> 
> 
> 
> 
>  extends="getClassBResult" groupBy="primKey1,primKey2">
> 
> 
> 
> 
> 
>  
> 
> and my select statement...
> 
>  resultMap="getClassBWithClassAsResult">
> 
> SELECT classB.*,classA.* FROM classB ,classA
> 
> WHERE classB.primKey1=#primKey1# AND classB.primKey2=#primKey2# AND
> gallery_image.SiteId=#siteId# AND gallery_image.BlockId=#blockId#
> 
> GROUP BY classB.primKey1,classB.primKey2,classA.primKey3
> 
> 
> 
> 
> 
> __
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> 
> 
> 
>   
> -
>  Start your day with Yahoo! - make it your home page 



Re: n+1 is triggering multiple queries, 3?

2005-07-13 Thread Kris Rasmussen
Thanks Clinton,
 
I will look into this myself when I have more time. I wish there were a MySql Profiler or something so that I could see what queries are actually being executed. Maybe I will step into your code if I get a chance.
 
KrisClinton Begin <[EMAIL PROTECTED]> wrote:
Kris,This is the right list ([EMAIL PROTECTED]).Sorry nobody responded.  I had a quick look when you originally sent it, and I couldn't see how it was possible that the groupBy or a nested resultMap could cause additional queries...Perhaps someone else has thoughts?  If not, you might have to write an isolated unit test and submit it through JIRA.Cheers,Clinton
On 7/9/05, Kris Rasmussen <[EMAIL PROTECTED]> wrote:


I have an n+1 mapping. When I look at mysql health in the administrator it apears that 3 queries are being executed instead of one. The first query gets executed when I retrieve the intial object via queryForObject. The next two queries are being executed when I attempt to access the List which stores the related objects from the main object. I am very curious what is going on since I don't know how Ibatis could even know what query to execute to get the items later?
 
The following maps are used to retrive a single instance of classB with all of its classA children stored in one of its properties which is of course a list.
 


... some basic properties





... some more properties





 
and my select statement...

SELECT classB.*,classA.* FROM classB ,classA
WHERE classB.primKey1=#primKey1# AND classB.primKey2=#primKey2# AND gallery_image.SiteId=#siteId# AND gallery_image.BlockId=#blockId#
GROUP BY classB.primKey1,classB.primKey2,classA.primKey3

__Do You Yahoo!?Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com 
		 Start your day with Yahoo! - make it your home page 

Re: n+1 is triggering multiple queries, 3?

2005-07-12 Thread Clinton Begin
Kris,

This is the right list ([EMAIL PROTECTED]).

Sorry nobody responded.  I had a quick look when you originally
sent it, and I couldn't see how it was possible that the groupBy or a
nested resultMap could cause additional queries...

Perhaps someone else has thoughts?  If not, you might have to write an isolated unit test and submit it through JIRA.

Cheers,
Clinton
On 7/9/05, Kris Rasmussen <[EMAIL PROTECTED]> wrote:

I have an n+1 mapping. When I look at mysql health in the
administrator it apears that 3 queries are being executed instead of
one. The first query gets executed when I retrieve the intial object
via queryForObject. The next two queries are being executed when I
attempt to access the List which stores the related objects from the
main object. I am very curious what is going on since I don't know how
Ibatis could even know what query to execute to get the items later?
 
The following maps are used to retrive a single instance of classB
with all of its classA children stored in one of its properties which
is of course a list.
 


... some basic properties





... some more properties





 
and my select statement...

SELECT classB.*,classA.* FROM classB ,classA
WHERE classB.primKey1=#primKey1# AND classB.primKey2=#primKey2# AND
gallery_image.SiteId=#siteId# AND gallery_image.BlockId=#blockId#
GROUP BY classB.primKey1,classB.primKey2,classA.primKey3
__Do You Yahoo!?Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



n+1 is triggering multiple queries, 3?

2005-07-09 Thread Kris Rasmussen

I have an n+1 mapping. When I look at mysql health in the administrator it apears that 3 queries are being executed instead of one. The first query gets executed when I retrieve the intial object via queryForObject. The next two queries are being executed when I attempt to access the List which stores the related objects from the main object. I am very curious what is going on since I don't know how Ibatis could even know what query to execute to get the items later?
 
The following maps are used to retrive a single instance of classB with all of its classA children stored in one of its properties which is of course a list.
 


... some basic properties





... some more properties





 
and my select statement...

SELECT classB.*,classA.* FROM classB ,classA
WHERE classB.primKey1=#primKey1# AND classB.primKey2=#primKey2# AND gallery_image.SiteId=#siteId# AND gallery_image.BlockId=#blockId#
GROUP BY classB.primKey1,classB.primKey2,classA.primKey3
__Do You Yahoo!?Tired of spam?  Yahoo! Mail has the best spam protection around http://mail.yahoo.com