Thanks a lot Varden, I have not done much 'tunning' so thinking and trying various bits out so your advice is great and will save me a lot of time in trial and testings
I am trying to imporve the data import and posting of inventory journals (P/L and BOM journals) for some data migration scripts One other thing I am not sure anyone can explain is why does the JournalCheckPost class take longer to run if I set the DoNotCheck = true? I would have thought skipping the check procedure would have made the posting of a journal quicker but it seems to have the opposite effect... Thanks again Varden James -----Original Message----- From: Axapta-Knowledge-Village@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Varden Morris Sent: 01 November 2007 11:37 To: Axapta-Knowledge-Village@yahoogroups.com Subject: Re: [Axapta-Knowledge-Village] select firstonly You are most welcome. I have done countless tuning with joins as oppose to individual selects and see major improvement in performance when the dataset is large. Another thing you could do is "field select" instead of selecting all the fields from each table. This can lead to major performance improvement. If a table is needed in a join for a filter condition and the fields are not being used I usually select the RecId field only to improve performance instead of selecting all the fields. For example, while select ItemId, LineAmount from salesLine join recId from inventTable where inventTable.ItemId == salesLine.ItemId && inventTable.ItemGroupId == "XXXX" { //Use ItemID and LineAmount (only) here } Selecting two out of 60 fields means a significant reduction in the amount of data being fetched from the database sitting on one server to the AOS and/or client on other computers across a network. You have to be careful with the field select at times. It can lead to a bug if you decide to use an additional field and you forget to add it to the select statement. Regards, Varden Morris 276 Taralake Terrace N.E. Calgary, Alberta T3J 0A1 Canada (403) 366-8434 (H) (403) 615-1604 (C) [EMAIL PROTECTED] ----- Original Message ---- From: James Flavell <[EMAIL PROTECTED]> To: Axapta-Knowledge-Village@yahoogroups.com Sent: Thursday, November 1, 2007 9:17:25 AM Subject: RE: [Axapta-Knowledge-Village] select firstonly Thanks Varden, Yes you are very correct. I guess I will test with the join. The concern I had was both tables are quite large in number of transactions so I was not sure join would work out to be the best approach but I think yes I should test it out to see. :) Thanks James _____ From: Axapta-Knowledge- [EMAIL PROTECTED] ups.com [mailto:Axapta-Knowledge- [EMAIL PROTECTED] ups.com] On Behalf Of Varden Morris Sent: 01 November 2007 11:02 To: Axapta-Knowledge- [EMAIL PROTECTED] ups.com Subject: Re: [Axapta-Knowledge- Village] select firstonly You can surely save on the number of calls being made to the database by joining the two tables in the while select instead of separate calls to the database for the while select followed by another select. If you do not use the index hint the database will choose an optimum index, provided that indexes exist and the database is configured to collect and update the statistics periodically. Regards, Varden Morris 276 Taralake Terrace N.E. Calgary, Alberta T3J 0A1 Canada (403) 366-8434 (H) (403) 615-1604 (C) [EMAIL PROTECTED] <mailto:vardenm% 40yahoo.com> com ----- Original Message ---- From: James Flavell <[EMAIL PROTECTED] <mailto:djf1994% 40gmail.com> com> To: Axapta-Knowledge- <mailto:Axapta- Knowledge- Village%40yahoog roups.com> [EMAIL PROTECTED] .com Sent: Thursday, November 1, 2007 8:05:29 AM Subject: [Axapta-Knowledge- Village] select firstonly Hi again everyone, Thanks Christoph for the feebdack on index. I have added indexes just to play safe. Another query I have is with the firstonly command. I understand basically how it works but want to know how it really works in practice Given this code: while select WMSPallet order by WMSPalletId { select firstonly InventPalletBP where InventPalletBP. PalletId == WMSPallet.wMSPallet Id; } Is it better to use firstonly in such a situation? I mean I am going to be looping through pallets so if I dont use firstonly a number of inventpalletbp table records will be fetched together which in theory would be a good thing to save on database calls. But then i am wondering will the records that are fetched be in any particualr order (e.g. by palletid) or just from the same page in the SQL server? I guess it should be read ahead according to the where clause or do I need to explicitly put an order by or index command against the InventPalletBP select statement to be sure of this? Looking forward to your input Thanks James [Non-text portions of this message have been removed] ____________ _________ _________ _________ _________ __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail. <http://mail. yahoo.com> yahoo.com [Non-text portions of this message have been removed] [Non-text portions of this message have been removed] __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com [Non-text portions of this message have been removed] Sharing the knowledge on Axapta. Visit www.frappr.com/axapta for axapta friends. Come and choose your preferred name for Microsoft Dynamics AX on the Axapta Knowledge Village, Visit www.axapta-knowledge-village.tk Yahoo! Groups Links