Another thought on this - if you don't need all of the data at the same time, a rowhandler will likely speed things up significantly by reducing the amount of memory consumed.
Larry On Jan 28, 2008 10:32 AM, Clinton Begin <[EMAIL PROTECTED]> wrote: > Hi Gerardo, > > When you do your JDBC test, do you iterate over the result sets and get each > of the columns from the result as well? You can't just run time > ps.execute() and say that it's faster. You have to actually READ all of the > data back, as in most cases the query runs very quickly, and it's the > transmission and marshalling of the data that takes the time. > > Also, if you are returning many thousands of rows, consider the cost to > instantiate the class as well (and consider what is in your constructor if > anything). Especially a DTO that has 30 properties. > > Cheers, > Clinton > > > -----Original Message----- > From: Gerardo Corro Fuentes [mailto:[EMAIL PROTECTED] > Sent: January-28-08 9:57 AM > To: user-java@ibatis.apache.org > Subject: poor performance > > Hi, > > I built a DAO with IBatis 2.2.0. Most of this DAO works properly, however > thre are a couple of queries that are very slow, it takes 2 minutes for them > to be completed while a plain JDBC querie takes only three seconds. > > I verified the slow quieries many times, and they actually look very similar > to others that run very fast. > > I also Spring 1.2; commons DBCP 1.4. > > Thanks!!! > > > > The ibatis config file looks like: > > <settings > > cacheModelsEnabled="false" > > enhancementEnabled="true" > > maxSessions="64" > > maxTransactions="8" > > maxRequests="128" > > useStatementNamespaces="true"/> > > > > > > > > > > > > <?sml version="1.0" encoding="UTF-8" ?> > > <!DOCTYPE sqlMap > > PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" > > "http://www.ibatis.com/dtd/sql-map-2.dtd"> > > <sqlMap namespace="CurvaHoraria"> > > <typeAlias alias="curvaHoraria" type="com.db.dto.DTO1"/> > > <resultMap id="curvaHorariaResult" class="curvaHoraria"> > > <result property="guidPm" column="guid_pm"/> > > <result property="fecha" column="fecha"/> > > <result property="periodo1" column="valor_h01"/> > > <result property="periodo2" column="valor_h02"/> > > <result property="periodo3" column="valor_h03"/> > > <result property="periodo4" column="valor_h04"/> > > <result property="periodo5" column="valor_h05"/> > > <result property="periodo6" column="valor_h06"/> > > <result property="periodo7" column="valor_h07"/> > > <result property="periodo8" column="valor_h08"/> > > <result property="periodo9" column="valor_h09"/> > > <result property="periodo10" column="valor_h10"/> > > <result property="periodo11" column="valor_h11"/> > > <result property="periodo12" column="valor_h12"/> > > <result property="periodo13" column="valor_h13"/> > > <result property="periodo14" column="valor_h14"/> > > <result property="periodo15" column="valor_h15"/> > > <result property="periodo16" column="valor_h16"/> > > <result property="periodo17" column="valor_h17"/> > > <result property="periodo18" column="valor_h18"/> > > <result property="periodo19" column="valor_h19"/> > > <result property="periodo20" column="valor_h20"/> > > <result property="periodo21" column="valor_h21"/> > > <result property="periodo22" column="valor_h22"/> > > <result property="periodo23" column="valor_h23"/> > > <result property="periodo24" column="valor_h24"/> > > <result property="periodo25" column="valor_h25"/> > > </resultMap> > > <sql id="fragmento_fechas"> > > ( > > vwpm.f_desde_pf <![CDATA[<=]]> to_date(#fecha_desde#,'yyyymmdd') > > OR vwpm.f_desde_pf <![CDATA[<=]]> to_date(#fecha_hasta#,'yyyymmdd') > > ) > > AND ( > > vwpm.f_hasta_pf <![CDATA[>=]]> to_date(#fecha_desde#,'yyyymmdd') > > OR vwpm.f_hasta_pf <![CDATA[>=]]> to_date(#fecha_hasta#,'yyyymmdd') > > ) > > AND ( > > vwpm.f_desde_pm <![CDATA[<=]]> to_date(#fecha_desde#,'yyyymmdd') > > OR vwpm.f_desde_pm <![CDATA[<=]]> to_date(#fecha_hasta#,'yyyymmdd') > > ) > > AND ( > > vwpm.f_hasta_pm <![CDATA[>=]]> to_date(#fecha_desde#,'yyyymmdd') > > OR vwpm.f_hasta_pm <![CDATA[>=]]> to_date(#fecha_hasta#,'yyyymmdd') > > ) > > AND ( > > vwpm.f_desde_cpf <![CDATA[<=]]> to_date(#fecha_desde#,'yyyymmdd') > > OR vwpm.f_desde_cpf <![CDATA[<=]]> to_date(#fecha_hasta#,'yyyymmdd') > > ) > > AND( > > vwpm.f_hasta_cpf <![CDATA[>=]]> to_date(#fecha_desde#,'yyyymmdd') > > OR vwpm.f_hasta_cpf <![CDATA[>=]]> to_date(#fecha_hasta#,'yyyymmdd') > > ) > > AND ( > > vwpm.f_desde_apmpf <![CDATA[<=]]> to_date(#fecha_desde#,'yyyymmdd') > > OR vwpm.f_desde_apmpf <![CDATA[<=]]> to_date(#fecha_hasta#,'yyyymmdd') > > ) > > AND ( > > vwpm.f_hasta_apmpf <![CDATA[>=]]> to_date(#fecha_desde#,'yyyymmdd') > > OR vwpm.f_hasta_apmpf <![CDATA[>=]]> to_date(#fecha_hasta#,'yyyymmdd') > > ) > > AND ( > > vwpm.f_desde_cpm <![CDATA[<=]]> to_date(#fecha_desde#,'yyyymmdd') > > OR vwpm.f_desde_cpm <![CDATA[<=]]> to_date(#fecha_hasta#,'yyyymmdd') > > ) > > AND ( > > vwpm.f_hasta_cpm <![CDATA[>=]]> to_date(#fecha_desde#,'yyyymmdd') > > OR vwpm.f_hasta_cpm <![CDATA[>=]]> to_date(#fecha_hasta#,'yyyymmdd') > > ) > > AND ( > > vwpm.f_desde_cpma <![CDATA[<=]]> to_date(#fecha_desde#,'yyyymmdd') > > OR vwpm.f_desde_cpma <![CDATA[<=]]> to_date(#fecha_hasta#,'yyyymmdd') > > ) > > AND ( > > vwpm.f_hasta_cpma <![CDATA[>=]]> to_date(#fecha_desde#,'yyyymmdd') > > OR vwpm.f_hasta_cpma <![CDATA[>=]]> to_date(#fecha_hasta#,'yyyymmdd') > > ) > > AND ( > > vwpm.f_desde_tc <![CDATA[<=]]> to_date(#fecha_desde#,'yyyymmdd') > > OR vwpm.f_desde_tc <![CDATA[<=]]> to_date(#fecha_hasta#,'yyyymmdd') > > ) > > AND ( > > vwpm.f_hasta_tc <![CDATA[>=]]> to_date(#fecha_desde#,'yyyymmdd') > > OR vwpm.f_hasta_tc <![CDATA[>=]]> to_date(#fecha_hasta#,'yyyymmdd') > > ) > > </sql> > > <select id="obtenerCurvas" resultMap="curvaHorariaResult" > parameterClass="curvaHoraria"> > > SELECT distinct(guid_pm), fecha, valor_h01, valor_h02, valor_h03, valor_h04, > valor_h05, valor_h06, valor_h07, > > valor_h08, valor_h09, valor_h10, valor_h11, valor_h12, valor_h13, valor_h14, > valor_h15, valor_h16, valor_h17, > > valor_h18, valor_h19, valor_h20, valor_h21, valor_h22, valor_h23, valor_h24, > valor_h25 > > from FLUMEN.vw_puntos_medida_ve vwpm, flumen.variables_periodo vp, > flumen.periodovar p > > where vwpm.id_ccaa = vp.id_sitio > > and substr(vwpm.tarifa, 1, 1) = substr(vp.tarifa, 1, 1) > > and vp.id_var = p.id_var > > and p.fecha <![CDATA[>=]]> #fecha_desde# > > and p.fecha <![CDATA[<=]]> #fecha_hasta# > > AND > > <include refid="fragmento_fechas"/> > > order by guid_pm, fecha > > </select> > > <select id="obtenerPMs" resultClass="java.lang.String" > parameterClass="curvaHoraria"> > > select distinct(guid_pm) from FLUMEN.vw_puntos_medida_ve vwpm > > WHERE > > <include refid="fragmento_fechas"/> > > </select> > > </sqlMap> > > > > > > > > > > > > > > > ------------------------------------------------------------------ > This e-mail and the documents attached are confidential and intended solely > for the addressee; it may also be privileged. If you receive this e-mail > in error, please notify the sender immediately and destroy it. > As its integrity cannot be secured on the Internet, the Atos Origin group > liability cannot be triggered for the message content. Although the > sender endeavours to maintain a computer virus-free network, the sender does > not warrant that this transmission is virus-free and will not be liable for > any damages resulting from any virus transmitted. > > Este mensaje y los ficheros adjuntos pueden contener informacion > confidencial destinada solamente a la(s) persona(s) mencionadas > anteriormente. Pueden estar protegidos por secreto profesional Si usted > recibe este correo electronico por error, gracias de informar inmediatamente > al remitente y destruir el mensaje. > Al no estar asegurada la integridad de este mensaje sobre la red, Atos > Origin no se hace responsable por su contenido. Su contenido no constituye > ningun compromiso para el grupo Atos Origin, salvo ratificacion escrita por > ambas partes. > Aunque se esfuerza al maximo por mantener su red libre de virus, el emisor > no puede garantizar nada al respecto y no sera responsable de cualesquiera > danos que puedan resultar de una transmision de virus > ------------------------------------------------------------------ > >