AFAIK, temptables are saved in RAM.
does anyone know how to calculate how much RAM does a single record in a table takes?
It seems too easy that is equal to the record size... :-k
Thanks in advance
-Mirko-
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog0
Comments
.
It alloc. with the first insert command and cont. up to the limit with every following modifications.
If this max Memory usage is finsihed, Nav writes a TempFile to the Disk. So your local Disk should also be fast for writeting. But here is also a restriction. NAV can only write 2GB files. If your "temptable" is to big (greater then 2GB) u became an errormessage with the words: "Error 131 - An attempt was made to move file pointer before beginning of file" or so ....
As you know, the memory will be freed until the table handle is finished / closed.
Hope that is correct.
Regards
but let's say i have a table with 300 records, how can i calculate how much memory this table will take?
maybe it will be 300*(sum of the lenght -in terms of kilobytes- of the fields)?
Hope 2 be clear...i can't explain it better on friday evening
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Anyway, i've another question: what if i create and fill an array of temptables? will I have 500kb ram available for each element in the array?(in order to don't swap memory)
Maybe you'll be asking yourself why am i asking these questions, and the reasons are:
- Improve my knowledge
- Try to improve a slow process: i have made all possible modifications to the C/AL code, and i can't see any bottlenecks in client monitor: the slowest operations a lot of find/next (16ms). The problem is that this table is the item ledger entry, which is not so huge in my database...but there are a lot of loops on this table.
For this reason, i want to store the item ledger entry in a temptable and loop on it, which is (obviously) really faster in my test environment...what can you (all) say?
P.S.: i think that 16ms for a find/next can be a problem...but i can't access sql server to further investigate it
P.P.S.: key selection is correct for all sets of filters
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
Just for ilustration simplified example:
could be replaced by
It is simplified, but same "logic" could be used for nested loops and complex filters. Rule is: if you already have read the record, do everything you need to do with it.
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
So this is not the way to increase the memory limit. You would need other variables.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
anyway...with the use of temptables (and some other minor fixes), i managed to bring the process time of the report from 1h52min to 15min...this is a GREAT improvement...i can swap memory without problems...now the real problem is how to avoid the 2GB limit...any idea?
@kine: unfortunately, i didn't developed this report, and i don't know the precise logic of it...as i'm doing this thing during the spare time, i can't ask the original developer...reverse engineering is not an option, as it's a bit complicated...up to now, i've modified the code without changing the logic (some ISEMPTY instead of FINDSET when i don't need rec values etc.)...I've already search for multiple (and/or useless) database calls as you suggested, but i couldn't find anyone...
P.S.: i don't think that pasting the code will be useful, as it is a report and you should import the text file in order to check it (if you want )...more than this, this report is part of an add-on and i don't think it should be correct to post it...
*EDIT: What if I process a block of records (there is a minor loop of "30 or so" turns on responsibility centers on the top of the process), delete the temptable, and refill it each turn?Is the memory freed?(i don't know how to test it by myself, sorry)
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
With version 2.01 I inserted 1.6MB ILE-records in a temptable without hitting the limit! (It was only VEEEEERRRRYYYY slow because of the writing to disk).
You can limit the size of the records by defining a temptable with ONLY the necessary fields and indexes.
AND(!) if you use a table ONLY as temptable, you don't need to put it in the customer's license!!!!!!!!
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
anyway...i'm trying to overload my temptable in order to see if i can delete unused records to free some space
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
Sinse NAV 2.00 i created my own Buffertable(s) for Customer Solutions where a need a TempTable. So, Table 50000 .. 50005 (for example) only Buffertables for some temp. Records.
(and also manage different keys, for sure)
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
Backup the new company.
Create a small Navision database.
Import the backup. (You don't need objects, just the company data).
Look at Database Information tables. Find the table (it should be the only table in the list.
Here you will have all the statistics on the average size of the table, including keys and sift fields. It want be exactly the same in the temptable, but pretty close and will then let you know approximately how much ram you will need. Also you can write routines to drop fields you don't need to see the effect on size this will have.
Ok, nice trick...i'll try it!
ok, then my question is: why don't declare the real table as temporary and use that table instead of creating a new one?is there something wrong with sifts and/or indexes, or is it only a "common practice" in order to not forgot the "Temp" property and make a disaster?
Thank you all for the valuable infos! =D>
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
The first thing i've done have been to find unnecessary loops...and i couldn't find them
Anyway, i'll try to search more carefully these loops... :-k
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
Then this is not a "buffer table" in this sense.
In your case why are you using a permanent table, it seems a temporary table would do what you need just fine.
:-k who told you that? I have been doing this since 1.1, never tried it in 1.0, but I assume it worked there also.
and this is not the only method...anyway, as I said, i'm doing this report during spare time...i'll let you know after some tests if and how i improved the process (buffer tables apart )
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
http://www.mibuso.com/forum/viewtopic.php?f=33&t=36521&view=unread#unread
I think it will perform a lot better after some (...a lot!) of basic SQL tuning...thank you all to have stopped me in doing this uber temptable, i'll let you know how is it after the tune!
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
Will the Instantiation of a temp table variable affect the I/O performance of the table?
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
And if you ONLY use it as a temptable,you don't need to put the table in the license!
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
:whistle: :whistle: :whistle: But this is never happened to me... :whistle: :whistle: :whistle:
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
Kamil, I'm just being worried that when the C/AL code reads the structure of the physical table for the instantiation, this will somehow make another process to wait until the reading finished or when the table is locked by another user / process, the instantiation process will wait until the lock is released. This table I mentioned is really big also being read and written so often. So I'm thinking that even using the table to declare the temp table will somehow add a slight loads to the table, isn't it?
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.