Hi all,
Valuable comments again. Thank you all!
I've set the Union query to Union all; have added indexes on joining columns and have timed the whole process through several loops to get an idea of performance; also have checked at what point the database is increasing in size.
Interestingly, the front end is now reaching the 2Gb size limit, still processing the data quite happily, but then stops growing in size. I also tried running as a compiled accde and the same thing happened. However, when I tried running compact and repair on the front end, I received corruption warnings advising the VBA project had been lost. Glad I had been taking regular backups before running the tests!
There is one query which takes 10 seconds to run, but this is not affecting the size of the database. The other eight queries used in the process all run/load in 1/2 seconds or less.
I've narrowed down the point at which the database increases in size to one query (which I had changed to union all). This query DOES contain a MAX aggregate in addition to the union and has several nested sub queries and DateAdd functions.
It's not quite clear if this is the problem as even when stepping through the code slowly, the database does not increase in size when this query is initially run. But the code then steps through the resulting recordset and at different points during that sub process, the database consistently increases in size by 200kb per employee. Running in batches of 200 employees I then see an overall increase of 40,000Kb per batch. The amount of employees I need to cycle through, this easily breaches the 2Gb limit.
So, I think next step will be refactoring the process to see if I can prepare the data prior to processing to simplify the query that is run.
Valuable comments again. Thank you all!
I've set the Union query to Union all; have added indexes on joining columns and have timed the whole process through several loops to get an idea of performance; also have checked at what point the database is increasing in size.
Interestingly, the front end is now reaching the 2Gb size limit, still processing the data quite happily, but then stops growing in size. I also tried running as a compiled accde and the same thing happened. However, when I tried running compact and repair on the front end, I received corruption warnings advising the VBA project had been lost. Glad I had been taking regular backups before running the tests!
There is one query which takes 10 seconds to run, but this is not affecting the size of the database. The other eight queries used in the process all run/load in 1/2 seconds or less.
I've narrowed down the point at which the database increases in size to one query (which I had changed to union all). This query DOES contain a MAX aggregate in addition to the union and has several nested sub queries and DateAdd functions.
It's not quite clear if this is the problem as even when stepping through the code slowly, the database does not increase in size when this query is initially run. But the code then steps through the resulting recordset and at different points during that sub process, the database consistently increases in size by 200kb per employee. Running in batches of 200 employees I then see an overall increase of 40,000Kb per batch. The amount of employees I need to cycle through, this easily breaches the 2Gb limit.
So, I think next step will be refactoring the process to see if I can prepare the data prior to processing to simplify the query that is run.