Subject Re: [IBDI] Firebird 1 - Selecting a range of records from a result set.
Author hannes hernler
!!
thats exactly the way I am doing!
and is doing well. especially in high load web applications where
always the same tables are queried (forum, geustbooks, shops....)
and you have got pages wit a fixed number of items.
I can optimze my queries and indexes.

I could speed up some queries from 120,000 fetches
to some 100 fetches for 1 result-page.

hannes hernler
--------------------------------------------------------
DWS - Delphi Web Script
developing professional web apps
look at http://www.dwscript.com
--------------------------------------------------------



----- Original Message -----
From: "Kevin Lawrence" <kevin@...>
> While the most generalized case isn't currently supported, it seems that
> this could be easily done for a specific case with a stored procedure:
>
> create procedure p_get_range(nStartPositionINTEGER, nEndPosition INTEGER)
> returns (<field_list>)
> as
> DECLARE VARIABLE nCount INTEGER;
> BEGIN
> nCount = 0;
>
> FOR SELECT <field_list>
> FROM <tablename(s)>
> ORDER BY <order by clause>
> INTO :<field_list>
> DO
> BEGIN
> nCount = nCount + 1;
> IF (nCount > nEndPosition nStartPosition) THEN
> EXIT;
> ELSE IF (nCount >= nStartPosition) THEN
> SUSPEND;
> END
> END
>
> Simply select from the procedure:
>
> SELECT * FROM p_get_range(10, 20)
>
> Kevin
>
> ----- Original Message -----
> From: "David Jencks" <davidjencks@...>
> To: <IBDI@yahoogroups.com>
> Sent: Wednesday, May 30, 2001 3:28 PM
> Subject: Re: [IBDI] Firebird 1
>
>
> > Hi,
> >
> > Since it is remarkably easy to implement, perhaps you would let on where
> > you would put it. For limit (n, m) would you just fetch rows up to m
and
> > discard the first n-1 of them? If this is in the client, wouldn't it be
> > equally fast to let the user discard the first n-1 rows? Where does the
> > parsing to recognize the request happen?
> >
> > Thanks
> > David Jencks
> >
> >
> > On 2001.05.30 10:39:11 -0400 Ann W. Harrison wrote:
> > > At 03:13 PM 5/30/2001 -0700, Peter Morris wrote:
> > > > > There is certainly a plan to do this. The core functionality for
> this
> > > >exists,
> > > > > but the feature has not yet been implemented.
> > > >
> > > >That is great ! Would that be a feature that has been decided for
V1,
> > > or
> > > >just a feature that someone casually mentioned and a few people
> casually
> > > >said "yes, would be quite nice" ? :-)
> > >
> > > Actually, what's proposed is just a way to limit the number of
> > > rows returned - thus 1 - 10 works but there's no easy way to ask
> > > for 11 - 20. There's no engine support for that functionality,
> > > though it is remarkably easy to implement in the API.
> > >
> > >
> > > Regards,
> > >
> > > Ann
> > > www.ibphoenix.com
> > > We have answers.
> > >
> > >
> > > Community email addresses:
> > > Post message: IBDI@yahoogroups.com
> > > Subscribe: IBDI-subscribe@yahoogroups.com
> > > Unsubscribe: IBDI-unsubscribe@yahoogroups.com
> > > List owner: IBDI-owner@yahoogroups.com
> > >
> > > Shortcut URL to this page:
> > > http://www.yahoogroups.com/community/IBDI
> > >
> > > Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
> > >
> > >
> > >
> > >
> >
> >
> > Community email addresses:
> > Post message: IBDI@yahoogroups.com
> > Subscribe: IBDI-subscribe@yahoogroups.com
> > Unsubscribe: IBDI-unsubscribe@yahoogroups.com
> > List owner: IBDI-owner@yahoogroups.com
> >
> > Shortcut URL to this page:
> > http://www.yahoogroups.com/community/IBDI
> >
> > Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
> >
> >
> >
>
>
> Community email addresses:
> Post message: IBDI@yahoogroups.com
> Subscribe: IBDI-subscribe@yahoogroups.com
> Unsubscribe: IBDI-unsubscribe@yahoogroups.com
> List owner: IBDI-owner@yahoogroups.com
>
> Shortcut URL to this page:
> http://www.yahoogroups.com/community/IBDI
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>