Best way to retrieve data from a large database file (Web)
Posted: Fri Jul 02, 2021 12:00 am
Hi everybody,
a customer is struggling with reading files with thousands of entries in RDMLX.
We looked at the sample "LargeLists" but this one works without key fields and always reads the same entries so it is not a suitable example for reading keyed logical files (views).
We read the first 100 entries of a file with more than 10000 entries that is keyed by let's say the EmployeeID.
100th Employee ID that was read is 123.
Then the user can push a button to retrieve the next 100 entries following the entry with ID 123.
We tried with
Select Fields(#ListFields) From_File(LogicalFile1) With_Key(#EmployeeID) Options(*STARTKEY)
in our server module:
#LastEmployeeID = *Zero at the first call, later on it receives the value of the last List item.
Select Fields(#ListFields) From_File(LogicalFile1) With_Key(#LastEmployeeID) Options(*STARTKEY)
#STD_NUM += 1
If (#STD_NUM <= 100)
Add_Entry To_List(#ListFields)
Else
Leave
Endif
Endselect
But this does not work!
Is Options(*STARTKEY) not usable in web server modules?
Then we tried
Select Fields(#ListFields) From_File(LogicalFile1) With_Key(#EmployeeID) Where(#EmployeeID > #LastEmployeeID)
#STD_NUM += 1
If (#STD_NUM <= 100)
Add_Entry To_List(#ListFields)
Else
Leave
Endif
Endselect
and got the result that they wanted.
Now my question:
Does this SELECT..WHERE statement make any sense in reading large files? If I understand correctly all table entries have to be read until I get the entries I want to add into my list. So I fear getting performance problems when reaching higher IDs.
What is the fastest way to retrieve table entries form a very large file in a key order "step by step"?
Many thanks in advance and best regards,
Joerg
a customer is struggling with reading files with thousands of entries in RDMLX.
We looked at the sample "LargeLists" but this one works without key fields and always reads the same entries so it is not a suitable example for reading keyed logical files (views).
We read the first 100 entries of a file with more than 10000 entries that is keyed by let's say the EmployeeID.
100th Employee ID that was read is 123.
Then the user can push a button to retrieve the next 100 entries following the entry with ID 123.
We tried with
Select Fields(#ListFields) From_File(LogicalFile1) With_Key(#EmployeeID) Options(*STARTKEY)
in our server module:
#LastEmployeeID = *Zero at the first call, later on it receives the value of the last List item.
Select Fields(#ListFields) From_File(LogicalFile1) With_Key(#LastEmployeeID) Options(*STARTKEY)
#STD_NUM += 1
If (#STD_NUM <= 100)
Add_Entry To_List(#ListFields)
Else
Leave
Endif
Endselect
But this does not work!
Is Options(*STARTKEY) not usable in web server modules?
Then we tried
Select Fields(#ListFields) From_File(LogicalFile1) With_Key(#EmployeeID) Where(#EmployeeID > #LastEmployeeID)
#STD_NUM += 1
If (#STD_NUM <= 100)
Add_Entry To_List(#ListFields)
Else
Leave
Endif
Endselect
and got the result that they wanted.
Now my question:
Does this SELECT..WHERE statement make any sense in reading large files? If I understand correctly all table entries have to be read until I get the entries I want to add into my list. So I fear getting performance problems when reaching higher IDs.
What is the fastest way to retrieve table entries form a very large file in a key order "step by step"?
Many thanks in advance and best regards,
Joerg