ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Larry Meadors <larry.mead...@gmail.com>
Subject Re: OT: COUNT query speed issue
Date Fri, 17 Jun 2005 03:43:31 GMT
Also, do you do this in the scope of a single transaction?

On 6/16/05, Ron Grabowski <rongrabowski@yahoo.com> wrote:
> Do things get faster if you have the database index remote_id and
> log_time?
> 
> --- Zoran Avtarovski <zoran@sparecreative.com> wrote:
> 
> > I have a quick query regarding the speed of count query I use to
> > generate a
> > chart, which is too slow at present and I'm looking for suggestions
> > to speed
> > it up.
> >
> > I pass a collection of the last 30 days data usage to a simple Flash
> > charting app and I use the ibatis query below  in a loop thirty times
> > to get
> > the data for each successive day. The table has about half a million
> > entries
> > and will only be getting bigger.
> >
> > SELECT COUNT(*) AS count FROM log  WHERE remote_id = #remoteId# and
> > log_time
> > BETWEEN #lowDate# AND #highDate#
> >
> >
> > The complete query (all thirty days) takes over a minute to complete,
> > which
> > causes timeouts. I did some profiling and the bottle neck is with the
> > above
> > query. Clearly, I'm doing something wrong. Is there a better formed
> > query
> > that will improve speed or should I be  looking at a different
> > approach to
> > this issue?
> >
> > I know this sounds stupid but I'm looking for pointers for best
> > practice so
> > I don't have to revisit this issue down the track.
> >
> >
> > Zoran
> >
> >
> >
> 
>

Mime
View raw message