Skip to Content.
Sympa Menu

freetds - RE: [freetds] absolute fetches

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Thompson, Bill D (London)" <ThompBil AT exchange.uk.ml.com>
  • To: "'FreeTDS Development Group'" <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] absolute fetches
  • Date: Tue, 8 Apr 2003 09:13:53 +0100

Hi,

I've worked out the required "wire protocol" for SQL server cursors of all
types - forward/backward/rowset/keyed - but this awaits implementation..
My aim is to put this in first for the ct-library cursor calls, but it
should be available for the ODBC driver when complete.

Bill


> -----Original Message-----
> From: James K. Lowden [SMTP:jklowden AT schemamania.org]
> Sent: 08 April 2003 09:03
> To: FreeTDS Development Group
> Subject: Re: [freetds] absolute fetches
>
> On Mon, 07 Apr 2003 17:09:52 -0400, Jon Pounder <JonP AT inline.net> wrote:
> >
> > Ok, is there any other way then to quickly run through the first n
> > records and throw away the results ?
> >
> > eg: I want rows 100 to 110, from looking at the code now, I gather than
> > to implement this, rows 1 to 99 are actually all transferred from the db
> >
> > server to the driver and then thrown away, is there any facility for
> > doing a fetch_next without actually transferring the data ?
>
> No, Jon, there's not. The TDS protocol is a pipe. You send it a query;
> it sends you results. The results don't live *anywhere* except in the
> pipe. Unlike other database systems (of which I know only a little),
> there's no server-side memory cache for the client library to talk to.
> The server simply selects the rows you specify, and shoots them out the
> pipe. Or dribbles, as the case may be.
>
> That's why you can't know the rowcount until the query's been processed
> and the rows fetched. The server doesn't itself know how many rows there
> were until it shipped them all.
>
> As Frediano said, there are several SQL techniques to compensate:
> temporary tables with identity columns, T-SQL cursors, even (ugh!) the
> "top" modifier, lately. However, except in unusual circumstances, none of
> these will be faster than simply reading and discarding the rows you're
> trying to skip.
>
> --jkl
> _______________________________________________
> FreeTDS mailing list
> FreeTDS AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds




Archive powered by MHonArc 2.6.24.

Top of Page