SKIP +1000 and SKIP -1000

88 views
Skip to first unread message

Marco Boschi

unread,
Aug 4, 2021, 4:42:22 AMAug 4
to
Hi,
how does the SKIP command works?
In a LAN using DBFCDX If I Open a table of 68000 records (123 mb dbf 2 mb fpt and 11 mb cdx files) if I skip +1 or -1 it's fast. If I SKIP +1000 and SKIP -1000 it takes 2 seconds. If I SKIP 9000 or SKIP -9000 it takes 20 seconds.
How does the SKIP command works?

Many thanks

dlzc

unread,
Aug 4, 2021, 10:52:16 AMAug 4
to
Dear Marco Boschi:

On Wednesday, August 4, 2021 at 1:42:22 AM UTC-7, Marco Boschi wrote:
> Hi,
> In a LAN using DBFCDX If I Open a table of 68000 records
> (123 mb dbf 2 mb fpt and 11 mb cdx files) if I skip +1 or -1
> it's fast.

It is finding its position in the index, then moving up or down one record.

> If I SKIP +1000 and SKIP -1000 it takes 2 seconds. If I SKIP 9000 or
> SKIP -9000 it takes 20 seconds.
> How does the SKIP command works?

I'd think it is getting "confused" by the indexes you have open, and filters you have in effect. What happens if you "SET ORDER TO" and "SET FILTER TO" with no argument, so that it can just use the record pointer? So it is likely moving record-by-record, through the index, in current index order. Pumping the data off the server, to your computer to perform the logic, and repeating 1000 or 9000 times.

Here are some options: https://www.itlnet.net/programming/program/Reference/c53g01c/ngf31ef.html
dbgoto(recno()-1000) ... should be pretty fast.

David A. Smith

Claudio H

unread,
Aug 4, 2021, 12:58:25 PMAug 4
to
David

He wants to SKIP records folowing the order set by the active index and honoring filters, not moving the pointer in the physical order of the records.
Regards

Claudio H

Marco Boschi

unread,
Aug 5, 2021, 3:38:01 AMAug 5
to
Many Thanks to all!
in my program I never skip +1000 I wrote some test to debug some slowness of my programs
> dbgoto(recno()-1000) ... should be pretty fast.
I have verifiedi this is very fast
it would be nice if you could do something like that
nCurKey := OrdKeyNo()
SkipKey( nCurKey + 1000)

King regards
marco

dlzc

unread,
Aug 5, 2021, 3:38:59 PMAug 5
to
Dear Marco Boschi:

On Thursday, August 5, 2021 at 12:38:01 AM UTC-7, Marco Boschi wrote:
...
> it would be nice if you could do something like that
> nCurKey := OrdKeyNo()
> SkipKey( nCurKey + 1000)

https://www.itlnet.net/programming/program/Reference/c53g01c/ng2a6f6.html
... sort of indicates that DBOI_POSITION could have been read and changed, to move to that position in the current index. But it says it was never implemented by RDDs under Clipper 5.3. I wonder if it ever was in (x)Harbour? Might trying reading it, decrementing it, and see if the record number changes. Might need to "flush the buffers" somehow, of course.

David A. Smith

Marco Boschi

unread,
Aug 6, 2021, 4:33:21 AMAug 6
to
Many thanks David
Reply all
Reply to author
Forward
0 new messages