I have a nightly process that extracts customer records from Lawson. Very simple: direct read, no conditions as we need to get the full dump of basic Customer data each night. , ARCUSTOMER and CUSTOMERDESC tables joined, returning only 5 columns. Using SQL query, it takes nearly an hour to extract 32,000 records. Thought I'd try using Lawson Query node to see if that could be faster. Lawson Query bombs on maximum records exceeded. So, questions: Would Lawson Query be faster than SQL Query? Is the maximum records limit a system setting? I tried overriding it and setting Maximum records to 50,000 in query builder to no avail. Just curious if this could be changed, if it will gain me speed in run time, or if I should just give up and stick with SQL Query.
I run the job through Landmark. When it aborts it says to check the IOS logs for more information. Where would IOS logs be?
Thanks!
I do not know about the Query node vs straight sql but I do know that we have way more customers than that and I have written queries against those 2 tables and have not had any issues with performance. My from clause is this:
from lawson.arcustomer arc inner join lawson.arcomp aco on (aco.company = arc.company) inner join lawson.custdesc cus on (cus.cust_group = aco.cust_group and cus.customer = arc.customer)
Thanks for the responses. You make a good point about using keys. Ideally I would use Company and Customer to link the 2 tables, but only 1 table has Company. CUSTDESC does not have Company; its keys are CUSTGROUP and CUSTOMER. ARCUSTOMER has Company as key, but does not have CUSTGROUP. Here's the SQL:
SELECT C.CUST_GROUP, A.CUSTOMER, C.NAME, A.COMPANY, A.NAT_FLAG FROM ARCUSTOMER AS A INNER JOIN CUSTDESC AS C ON A.CUSTOMER = C.CUSTOMER ORDER BY CUSTOMER, COMPANY
Thanks. I think that's pretty much what I've done. Could be wrong - always room for error. Doesn't appear to make a difference yet. If I run in SQL studio it takes less than a second to give me result set. Run the process through Landmark and it's a different story. Updated SQL I'm using:
SELECT C.CUST_GROUP, A.CUSTOMER, C.NAME, A.COMPANY,A.NAT_FLAG FROM ARCUSTOMER AS A INNER JOIN ARCOMP AS B ON A.COMPANY = B.COMPANY INNER JOIN CUSTDESC AS C ON C.CUST_GROUP = B.CUST_GROUP WHERE C.CUSTOMER = A.CUSTOMER ORDER BY CUSTOMER, COMPANY
Hi - I am writing the output to message builder first. Once it's completed, the message builder contents are written to the output file.
Unless I'm going blind (which could be the case late on Friday afternoon), I think the second SQL query is doing exactly what you are suggesting in the most recent SQL statement corrections. So far, it's running 45 minutes through Landmark.
A clarification: the logging level on the process is set to None in Landmark. I don't know if there is other logging going on behind the scenes - I am not a Lawson or Landmark administrator, don't have the access or knowledge to dig around the bowels of the system. I do think there is something very wrong somewhere in Lawson and/or Landmark because I changed the query to be a straight read on only one of the tables: ARCUSTOMER. It has 33K records. Since I'm pulling only 4 fields, this should be a snap. Uploaded the process, launched the trigger for it. It ran 48 minutes. I think the query isn't the problem but I suspect our Lawson and/or Landmark installation is faulty: configuration and/or space issues.
Which brings me back to my original question in my post: I switched from a SQL query to using a Lawson query and the process always failed with the error that the maximum number of records was exceeded. I cannot find any documentation on the Lawson query node that says there is a record limit. So, I'm wondering if there is one or if one could have been configured during the software installation process. If there is no record limit on the Lawson query node, then could this error indicate a not-enough-space available issue?
You can try adding &MAX=99999 or &MAX=ALL as part of the query string, but regardless of what you put for the &MAX= value, the maximum number of records will be limited by the IOS parameter setting com.lawson.ios.dig.db.maxRecsQuery; even if you have a larger number, there is still a hard-coded limit of records (I think it's 10,000) in the IOS Data servlet.
Using the SQL query bypasses that limitation. However, both the Lawson query and the SQL query return the results as javascript variables, so if when have a large number of rows, the amount of memory consumed for those variables grows considerably and the query returns very slowly as a result, e.g. 33K rows * 4 data columns = a lot of variables and memory.
One thing you might want to try is to shard through the data retrieval by looping and retrieving based on the last digit.
i.e.
from x = 0 to 9 select xxx..... WHERE RIGHT(CUSTOMER,1) = x
That's what I do for some queries that I know will return a lot of data..
Thanks for the info on the record limit. I did try the MAX argument when using the Lawson query but it still failed on the maximum record limit surpassed error. So the SQL query will be the way to go.
I'm not sure I quite understand the "shard" technique. I understand using it to retrieve all customers ending in '1', then ending in '2', and so on. But what are you doing with each of those result sets? Writing them to MsgBuilder then appending them to a file?
For a very simple, straightforward extract of 5 fields for 40K records - that amount of work should not be required.