ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From netsql <net...@roomity.com>
Subject Re: Slow query update...
Date Thu, 28 Jul 2005 02:50:34 GMT
I wonder if "prepared" statment is somhow hiting to the optimizer that 
this has been optimized allready and that it has a querry plan.
It would take few lines of code to reproduce w/ JDBC code prepared 
statment and not.

.V


Greg Day wrote:
> Hi Daniel and Netsql,
> 
> Thanks for the reply. The odd thing is, I can trace it down to the PreparedStatement.execute
inside ibatis, and I can see the table scan. So it appears, through whatever mechanism, ibatis
is changing how its executed. P6spy reports that the query is exactly the same in both cases.
> 
> my configs:
> 
> <sqlMapConfig>
>     <settings cacheModelsEnabled="true" enhancementEnabled="true" lazyLoadingEnabled="true"
errorTracingEnabled="false" maxRequests="32" maxSessions="10" maxTransactions="5" useStatementNamespaces="false"/>
>     <transactionManager type="EXTERNAL">
>         <property name="SetAutoCommitAllowed" value="false"/>
>         <dataSource type="JNDI">
>             <property name="DataSource" value="java:/jdbc/basil"/>
>         </dataSource>
>     </transactionManager>
> 
> and the query is:
> 
> <statement id="findPlacementByPlacementId" parameterClass="java.lang.Long" resultClass="Placement"
>
>         SELECT
> 	       p.placement_id AS oid
> ...
>             ,e.public_travel_cost AS publicTravelCost
> ...
>         FROM PLACEMENT p, EER_PLACEMENT_ADDITIONAL e
>         WHERE p.placement_id = #value#
>         AND p.placement_id *= e.placement_id
>     </statement>
> 
> 
> i've had no problems with ibatis previously, but the essential thing is: running in ibatis=table
scan, outside=not. I am guessing theres something stuffed with my database (indexes, keys
etc), but im a bit stumped why running in ibatis causes the table scan!
> 
> Thanks for your help
> Greg
> 
> -----Original Message-----
> From: Daniel Henrique Ferreira e Silva [mailto:dhsilva@gmail.com]
> Sent: Thursday, 28 July 2005 1:52 p.m.
> To: user-java@ibatis.apache.org
> Subject: Re: Slow query update...
> 
> 
> Hi Greg,
> 
> iBATIS doesn't change the way your SQL run on your database. It is
> basically JDBC wrapped in an easier and cleaner framework.
> 
> After some time reading about other people experience with iBATIS, i'd
> say this issue is probably caused by something in your code, not in
> iBATIS.
> 
> How are you setting it up?
> How are your maps?
> Tell us about your configs so we can help you to fix this issue.
> 
> Cheers,
> Daniel Silva.
> 
> On 7/27/05, Greg Day <Greg.Day@tec.govt.nz> wrote:
> 
>> 
>>
>>Hi all 
>>
>>regarding my ultra-slow query when running through ibatis.. 
>>just to recap, if I run a sybase query through Ibatis (inside jboss), it
>>goes really slow, if I run it through jdbc (inside jboss) its quick. 
>>
>>The query is essentially a select * by unique identifier (which has an
>>index). 
>>
>>Basically, the database is doing a table scan on this table when the query
>>is run through ibatis. It doesnt do the table scan when its run through
>>jdbc. 
>>
>>So, my question is: what is ibatis doing here? are there hints that it gives
>>to sybase that tells it something about query plans? im very confused... 
>>
>>any help would be much appreciated. 
>>
>>Thanks 
>>Greg
> 
> 


-- 

.V

People are conversing... without posting their email or filling up their
mail box.
roomity.com <http://roomity.com/launch.jsp>

No sign up to read or search this Rich Internet App.


Mime
View raw message