Skip to Content.
Sympa Menu

freetds - Re: large queries and TDS 7.0 revisited

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Brian Bruns <camber AT ais.org>
  • To: TDS Development Group <freetds AT franklin.oit.unc.edu>
  • Subject: Re: large queries and TDS 7.0 revisited
  • Date: Mon, 23 Oct 2000 18:13:45 -0400 (EDT)


Thanks for the patch. I've commited it.

I don't really think this will affect what Mike is seeing though as a 500
byte query executes in ~10ms and a slightly larger one executes in ~150
which would be a increase in strlen calls of aproximately 20% tops. On my
system (a pathetic 233mhz box) strlen on 500 bytes runs in about 3
microseconds, thus a 140 millisecond increase would require an astounding
47,000 calls to strlen(). And I know Mike has faster hardware than I :-)

I think we must look to the network or the SQL Server on this one. Any
ideas?

Brian

On 22 Oct 2000, Rusty Conover wrote:

> Brian Bruns <camber AT ais.org> writes:
>
> > Query times are a combination of size of result set (columns and rows) and
> > the usefulness of indexes and the query optimizers ability to generate a
> > decent query plan. You may want to run it with showplan and noexec to see
> > if your query plan is any good. The size of the query text in the process
> > should be negligible and more importantly has nothing to do with the
> > client (ours or microsofts). Of course there could be a bug, but I find
> > it hard to envision anything the small query/large query code differences
> > could be doing to cause it.
> >
> > On to the meat of your post. There should only be one reference to '512'
> > left in write.c (And I just checked in the fix for that...) If you are
> > seeing more, then the snapshot is not picking up the right stuff.
> >
> > Why not send me the text of the query offlist and I'll run it through
> > under TDS 4.2 with the latest code to see what's up.
> >
>
>
> Brian,
>
> The problem for large queries taking a while to send is your
> tds7_ascii2unicode() function in login.c. In the body of your for
> loop you are continually calling strlen() which computes the length of
> the string each time the loop is executed. You really only need to
> compute the length of the string once, also you can make the length a
> constant so the function is even faster. Here are my fixes:
>
> char *tds7_ascii2unicode(const char *in_string, char *out_string, int
> maxlen)
> {
> register int out_pos = 0;
> const size_t string_length = strlen(in_string);
> register int i;
>
> memset(out_string, 0, string_length*2);
> for (i=0; i<string_length; i++) {
> out_string[out_pos]=in_string[i];
> out_pos += 2;
> }
> return out_string;
> }
>
> Cheers,
>
> Rusty
> --
> Rusty Conover
> Systems Programmer
> Zoot Enterprises Inc, www.zootweb.com
>






Archive powered by MHonArc 2.6.24.

Top of Page