Discussion Board for collaboration on QlikView Scripting.
It might not make a diiference but I was wondering if there was any efficienies with dropping all resident tables at end of script versus one at a time throughout the script.
Go to Solution.
I expect (maybe unreasonably) that dropping a table allows to free up some memory - hence always drop a table as soon as it's not needed anymore.
To drop multiple tables
Drop Tables TableName1, TableName2....;
To drop single tables
Drop Table TableName;
Sorry I didn't make myself clear. What I am wondering does it make a difference one way or aonther to drop all temporary tables at one time at end of script versus one at a time throughout the script? Is either way more efficient?
Yes Michael is correct.
During the reload each and every table placed in memory(RAM) for faster access. If the data is huge then it slow downs further process.
It is a good practice to delete the tables often when the table is needed no more.
Btw. it also slows down with associations between tables on same column names. So, recommendation is always to drop temp tables at early stage (if not needed later).
first estimate the number of tables and use the following code ,
suppose my estimation is 250 tables so i wrote 250 in following code :
for i = 0 to 250
LET d = TableName(i);
if isnull(d) then
i = 250
if d <> null() then
(note: it works for less than or equal to 250 tables ..if you require more than that just replace the digit in code as per your requirement)
You don't have to estimate the number of tables if you use the NoOfTables() function:
vTables = TableName(0);FOR i = 1 to NoOfTables() - 1
LET d = TableName(i); LET vTables = vTables & ', ' & d; TRACE $(vTables);NEXTDROP Tables $(vTables);
The TRACE statement isn't necessary, I used it to verify the string was building properly...
I'm not sure how many tables can be listed in one DROP Tables command, though...
Try this script
FOR i = 1 to NoOfTables()
DROP Table $(i);