Skip to Content.
Sympa Menu

freetds - Re: SQLServer and executeQuery

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Michael Peppler <mpeppler AT peppler.org>
  • To: "TDS Development Group" <freetds AT franklin.oit.unc.edu>
  • Subject: Re: SQLServer and executeQuery
  • Date: Tue, 7 Aug 2001 16:36:43 -0700


Brent L Johnson writes:
> I think I've mentioned this before, but after more testing it's become a
> huge problem (seeing as my client wants to start beta testing tomorrow).
>
> I've put millisecond timers around lots of the code and I've found that the
> executeQuery() statement is taking around 2 minutes 40 seconds to run my
> query. This is not an acceptable time to wait for a simple report. Could
> anyone give me any pointers of where else to look to fix this problem?
>
> At first I thought it may be the FreeTDS driver. I downloaded the trial
> version of the JTurbo driver and gave it a try and the queries are just as
> slow. The wait time is between the executeQuery and actually processing
> the
> results. Running through an rs.next() while loop is taking no time
> (compared to the 2 mins of the query).
>
> I also checked out the MS SQL Server machine and the task manager says that
> the machine still has plenty of ram and CPU processing left - so it's not
> even really flenching returning all the results.
>
> Also, strangely enough, in my 2 min 40 sec query I was doing a "select top
> 10 ....". I found that if I removed the "top 10" and let it just return
> all
> the results it lowered the time for executeQuery down to a little over a
> minute (still not really acceptable).

The first thing to do in this situation is to run a showplan of the
query to see what it is doing.

If the TOP 10 request ends up doing a table scan then you're bound to
run very slowly, and this won't use a lot of CPU on the server side
(though it will do IO like crazy).

Michael
--
Michael Peppler - Data Migrations Inc. - http://www.mbay.net/~mpeppler
mpeppler AT peppler.org - mpeppler AT mbay.net
International Sybase User Group - http://www.isug.com




Archive powered by MHonArc 2.6.24.

Top of Page