Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.
Fastest access?
Question for the "under the hood" guys..
Considering 3 ways of "reading" records from OI tables: READ, READO and XLATE.
I'm currently stripping the file variable of any MFS's for the purpose of this exercise, and storing file variables in a labeled Common.
Other than being able to reference by field name (for symbolics), is there any reason to use/prefer Xlate over a straight Read/ReadO?
I'm considering coming up with an Xlate replacement that would utilize raw file variables for both data and dict Reads, likely using CalculateX for symbolics. Also considering buffering the last 5000+ records read (for big batch processes).
I'm working with a client with some lazy programmers, so I'm trying to come up with a way for them to use their repeated Xlates/equivalents without the serious performance hit we're seeing.
Any suggestions?
Considering 3 ways of "reading" records from OI tables: READ, READO and XLATE.
I'm currently stripping the file variable of any MFS's for the purpose of this exercise, and storing file variables in a labeled Common.
Other than being able to reference by field name (for symbolics), is there any reason to use/prefer Xlate over a straight Read/ReadO?
I'm considering coming up with an Xlate replacement that would utilize raw file variables for both data and dict Reads, likely using CalculateX for symbolics. Also considering buffering the last 5000+ records read (for big batch processes).
I'm working with a client with some lazy programmers, so I'm trying to come up with a way for them to use their repeated Xlates/equivalents without the serious performance hit we're seeing.
Any suggestions?
Comments
What are the caching benefits for an Xlate?
Thanks again!
Caching simply means it returns the last known record for a given Key ID without having to read from the disk. So, unless you are reading the same Key ID more than once, there is no benefit to caching.
Would using Xlate be better than using the BFS and doing the caching myself?
Note: Xlate only caches up to 9 reads (regardless of which Key ID) and then it recycles the cache. So, this caching is not indefinite.
This is good to know. I have a routine which gets called 1000s of times, and each time it's called it needs to read a config record. Since it uses xlate, it won't have to read it every time, only once? Perfect.
*I could pass the config record to the routine, but i'd rather not as it makes the routine more complicated to call...
Well, as I noted above, Xlate will use its internal cache 9 times and then it goes back to the disk. So, you need to decide if that is enough for you. We wrote our own service module (Database_Services) with a ReadDataRow service to replace Xlate and normal Open/Read statements. This service has a parameter that allows the developer to determine if cached data should be used and how stale the cache can be (i.e., how old must it be before it gets re-read from disk).
The 2nd function is where the magic happens. It's a replacement for Xlate that I've called TLate. Like XLate, you pass the tablename and the ID. There are 2 other (optional) parameters: the FMC or Fieldname that you want to extract and one more boolean flag. The ID and Field parameters work just like in XLate; and if you leave null, it will return an entire record. TLate will use RTP65 to create and maintain a hash table. Any calls to TLate will first check the hash table to see if the record has been read before. If not, it reads the record and writes it to the hashtable. The record, whether hashed or read, is used to fulfill the call. The optional 4th parameter is a flag that will cause TLate to bypass the hash table and just read from the table. Of course, the OI table in question is opened with the TOpen function.
My client had a process that involved the reading of hundreds of support records for every one "main" record, and hundreds of "main" records, which resulted in hundreds of thousands of Reads, many of which were the same records over and over. It took over 7 Minutes to return results. Using these functions, the process runs in 9 seconds! HUGE improvement. It won't work for every purpose, but I highly recommend.
"Well, as I noted above, Xlate will use its internal cache 9 times and then it goes back to the disk. So, you need to decide if that is enough for you. We wrote our own service module"
woops I missed that part. OK, i will just pass in the data rather than reading it every time...even though that is annoying.
@Michael
hi sounds complicated...not sure if i can do this in my system. But yes, i had a similar problem to you,and i used srp hash table.
I don't think you will find it too complicated, but you will probably want to build this out in small steps. Or...you could always ask to someone to provide you their own solution. If you have either our full FrameWorks or the HTTP Framework product then you will also have Database_Services already.
Database_Services
Sorry I must have missed the announcement.