"The most common causes of db bloat are over-use of temporary tables and over-use of non-querydef SQL."The opposite of what?
"The most common causes of db bloat are over-use of temporary tables and over-use of non-querydef SQL."The opposite of what?
Read her post again. I don't think she said what you claim she said.We just had a discussion where no consensus was reached on bloat caused by querydefs. I'm not qualified to "rule" on that. But unproven opinions should be challenged.
I was specifically referring to Pat's statement that Querydefs don't create bloat. Like I said, I don't know, but many seem to think the opposite is correct.
Are you saying that deleting records using a QueryDef has the same effect on bloat as running a SQL statement in code?Thank you, David. I reviewed the article and it explicitly upholds two issues that I have long said were significant.
First, it is caused by record deletion.
I will add that it would also be caused by updates within transaction situations including the case of simple DB.Execute SQL dbFailOnError action queries when the update succeeds. This is because in cases with transaction rollback potential, both the old and new records have to coexist although only the old record is visible until the COMMIT operation (actual or in effect) removes the old records and makes the new records take their place.
Second, it is a good idea to close recordsets because of the data structures they leave behind in process work spaces. Here is a direct statement from Microsoft on the subject.
Prevent database bloat after you use DAO - Microsoft 365 Apps
Describes how to prevent database bloat that occurs when the database grows rapidly in size after you use Data Access Objects (DAO) to open a recordset. To resolve this issue, you need to call the Close method of the recordset to explicitly close it.learn.microsoft.com
this one:Read her post again. I don't think she said what you claim she said.
And MajP already made the point I was going to make about "the opposite".
Whether a QueryDef or an SQL statement is executed in the VBA code does not matter for the database with the tables. You could also delete the data records manually in the table, the database size will remain the same in all 3 variants, as the data record is only marked as deleted and only Compact cleans up.Are you saying that deleting records using a QueryDef has the same effect on bloat as running a SQL statement in code?
And what about that statement is the opposite of what you believe?this one:
"The most common causes of db bloat are over-use of temporary tables and over-use of non-querydef SQL."
My main point is this: If one intends to provide clarity with regard to an assumption, a blanket, unqualified claim that "the opposite is true", which could apply to multiple things, ironically tends to come up short in that same regard.I assume "The most common causes of db bloat are over-use of ... non-querydef SQL" is meant.
Please note that this text is from 2003. The ACE (formerly JET) engine has come a long way since then.
There it is, the Front End Myth propagated from that observation 25 years ago. I always had my doubts about the code being a better way.Whether a QueryDef or an SQL statement is executed in the VBA code does not matter for the database with the tables. You could also delete the data records manually in the table, the database size will remain the same in all 3 variants, as the data record is only marked as deleted and only Compact cleans up.
Example:
Backend with a table with approx. 100k data records: File size 4492 kB
=> 1x copied for QDF deletion and 1x copied for VBA/SQL deletion.
=> Frontend created and the table of both backend files linked.
1x deleted with Querydef
1x deleted with Currentdb.Execute "delete from tabTest"
=> BE file size in both variants after deletion: 4492 kB
Only after Compact the file size goes to 436 kB
The situation is different in the frontend:
Front end compressed: file size: 404 kB
After executing the VBA/SQL deletion: 404 kB
After executing the QDF deletion: 408 kB ... +4kb (=1 page) .. I assume: because the execution plan is saved.
Each additional execution of the QueryDef does not change the file size.
Are you saying that deleting records using a QueryDef has the same effect on bloat as running a SQL statement in code?
That's interesting. The record locking must somehow be carried out by the backend, right? Somethings are going on back there, you would think.Remember that for native Access back-ends, there IS no active SQL engine. A native Access file is a FILE-SHARED database for which the only active SQL engine resides on the same machine that hosts the front-end file and that engine must SHARE the back-end file. This may be a major contributor to the reason that Access DOES NOT have an intrinsic garbage collection method running in the background.
Of course it does. Do you really think there are two separate database engines? There are not. Whether the query starts as a saved querydef (which is it's most efficient state since the query plan has already been generated) or as a VBA string which has to be compiled to create an execution plan before it runs, it is still the same database engine that executes the execution plan.Are you saying that deleting records using a QueryDef has the same effect on bloat as running a SQL statement in code?
LOL, you're as bad as me getting distracted from whatever the real mission is. Thanks for taking the time to post that.Of course it does.
The record locking must somehow be carried out by the backend, right? Somethings are going on back there, you would think.