Re: Network Issue
Posted: Mon Jan 13, 2014 4:44 pm
Jeff,
My advise is to avoid filters. Filters require sending the entire database across the network--even if you only have 1 record in the filtered data.
It looks like your example filter can be easily changed to an index, then you use scopes. This will only send the filtered records across the network. This could be hundreds, or even thousands, of times faster.
Also, I would not use a temp index. Again, building an index requires sending the entire database across the network. And as Tim said, eliminate the trims. I would also eliminate the alias references in the index. This allows you to open multiple copies of the database in different workareas (why is another topic).
Other general points:
1) Insead of using upper(cLast) in the scope just convert it first. This only only requires one call to upper() rather than once for each record.
2) For ID numbers such as ID and MRN, these should be converted to all upper case in the GET and stored in the database in all upper case. This prevents having to call UPPER() in the filter and index. In the GET you use the PICTURE clause to force all input to upper case.
Upon reflexion, I'm not clear on exactly what you are trying to filter out. It looks like you have a screen that allows partial data entry--one or more fields of 4 fields. Is that what you are doing? Please clarify.
Also I am not sure why you are doing trimming. Is this to allow partial data entry? If so, you could do this preprocessing instead:
cLast:= upper(rtrim(cLast))
cFirst:= upper(rtrim(cFirst))
If you want to allow partial data entry of ID and MRN then also do:
cID:= rtrim(cID)
cMRN:= rtrim(cMRN)
And you will have to elminate the == in the scopes. However, I am not sure how valuable partial ID numbers are. I would think that someone either has the entire number or none of it.
OK, this is probably TMI (too much information) for one message.
Regards,
James
My advise is to avoid filters. Filters require sending the entire database across the network--even if you only have 1 record in the filtered data.
It looks like your example filter can be easily changed to an index, then you use scopes. This will only send the filtered records across the network. This could be hundreds, or even thousands, of times faster.
Also, I would not use a temp index. Again, building an index requires sending the entire database across the network. And as Tim said, eliminate the trims. I would also eliminate the alias references in the index. This allows you to open multiple copies of the database in different workareas (why is another topic).
Code: Select all | Expand
index on upper(LAST)+upper(FIRST)+ID+MRN to ...
...
cLast:= upper(cLast)
cFirst:= upper(cFirst)
...
set scopetop to upper(last)=cLast .and. upper(first)=cFirst .and. ID==cID .and. MRN==cMRN
set scopebottom to upper(last)=cLast .and. upper(first)=cFirst .and. ID==cID .and. MRN==cMRN
go top
Other general points:
1) Insead of using upper(cLast) in the scope just convert it first. This only only requires one call to upper() rather than once for each record.
2) For ID numbers such as ID and MRN, these should be converted to all upper case in the GET and stored in the database in all upper case. This prevents having to call UPPER() in the filter and index. In the GET you use the PICTURE clause to force all input to upper case.
Upon reflexion, I'm not clear on exactly what you are trying to filter out. It looks like you have a screen that allows partial data entry--one or more fields of 4 fields. Is that what you are doing? Please clarify.
Also I am not sure why you are doing trimming. Is this to allow partial data entry? If so, you could do this preprocessing instead:
cLast:= upper(rtrim(cLast))
cFirst:= upper(rtrim(cFirst))
If you want to allow partial data entry of ID and MRN then also do:
cID:= rtrim(cID)
cMRN:= rtrim(cMRN)
And you will have to elminate the == in the scopes. However, I am not sure how valuable partial ID numbers are. I would think that someone either has the entire number or none of it.
OK, this is probably TMI (too much information) for one message.
Regards,
James