You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Greg Day <Gr...@tec.govt.nz> on 2005/07/21 22:49:47 UTC
Slow ibatis query
Hi all
I have a strange problem, we are using ibatis as our data access layer, and everything generally goes fine.
I recently added a query, which essentially does a "select * from X where primary_key = ?"
This query is very fast (300ms) when run externally through a database console, or using jdbc, or using direct jdbc inside jboss. even using the same connection as ibatis. But... when I run it using ibatis, it takes 4-5 seconds...
now, I stepped through the ibatis code, and everything is fast up to the point of ps.execute (where the prepared statement is executed), then everything stops for 4-5 seconds while the query is executed.
Huh? Im doing exactly the same, executing a prepared statement with my jdbc version, so what is going on? Im very confused, I don't even know where to start looking. If anyone has any ideas.... they would be gratefully received.
Thanks!
Greg
Re: Slow ibatis query
Posted by Tuncay Baskan <tb...@gmail.com>.
If your database server is SQL Server, Profiler can help to see what
is going to database server.
On 7/22/05, Ed Griebel <ed...@gmail.com> wrote:
> You could try using p6spy to see what query(s) iBatis is sending along
> and if it's what you expect.
>
> http://www.p6spy.com/
>
> -ed
>
> On 7/21/05, Greg Day <Gr...@tec.govt.nz> wrote:
> >
> >
> > Hi all
> >
> > I have a strange problem, we are using ibatis as our data access layer, and
> > everything generally goes fine.
> > I recently added a query, which essentially does a "select * from X where
> > primary_key = ?"
> >
> > This query is very fast (300ms) when run externally through a database
> > console, or using jdbc, or using direct jdbc inside jboss. even using the
> > same connection as ibatis. But... when I run it using ibatis, it takes 4-5
> > seconds...
> >
> > now, I stepped through the ibatis code, and everything is fast up to the
> > point of ps.execute (where the prepared statement is executed), then
> > everything stops for 4-5 seconds while the query is executed.
> >
> > Huh? Im doing exactly the same, executing a prepared statement with my jdbc
> > version, so what is going on? Im very confused, I don't even know where to
> > start looking. If anyone has any ideas.... they would be gratefully
> > received.
> >
> > Thanks!
> > Greg
>
--
/tb.
Re: Slow ibatis query
Posted by Ed Griebel <ed...@gmail.com>.
You could try using p6spy to see what query(s) iBatis is sending along
and if it's what you expect.
http://www.p6spy.com/
-ed
On 7/21/05, Greg Day <Gr...@tec.govt.nz> wrote:
>
>
> Hi all
>
> I have a strange problem, we are using ibatis as our data access layer, and
> everything generally goes fine.
> I recently added a query, which essentially does a "select * from X where
> primary_key = ?"
>
> This query is very fast (300ms) when run externally through a database
> console, or using jdbc, or using direct jdbc inside jboss. even using the
> same connection as ibatis. But... when I run it using ibatis, it takes 4-5
> seconds...
>
> now, I stepped through the ibatis code, and everything is fast up to the
> point of ps.execute (where the prepared statement is executed), then
> everything stops for 4-5 seconds while the query is executed.
>
> Huh? Im doing exactly the same, executing a prepared statement with my jdbc
> version, so what is going on? Im very confused, I don't even know where to
> start looking. If anyone has any ideas.... they would be gratefully
> received.
>
> Thanks!
> Greg