ACC: Database Grows Rapidly When You Modify SQL StatementsLast reviewed: August 29, 1997Article ID: Q165823 |
The information in this article applies to:
SYMPTOMSAdvanced: Requires expert coding, interoperability, and multiuser skills. Each time you modify the SQL property of a query, the size of your database increases. This applies to SQL statements that you use in the RecordSource property of a form or report, as well as to stored queries on the Queries tab of the Database window. This article assumes that you are familiar with Visual Basic for Applications and with creating Microsoft Access applications using the programming tools provided with Microsoft Access. For more information about Visual Basic for Applications, please refer to your version of the "Building Applications with Microsoft Access" manual. NOTE: Visual Basic for Applications is called Access Basic in Microsoft Access version 2.0. For more information about Access Basic, please refer to the "Building Applications" manual.
CAUSEThe query is saved each time you modify its SQL property. Because the Microsoft Jet database engine does not reuse the same space in the database when the query is saved, the database increases in size.
RESOLUTIONYou can use the following techniques to work around the problem:
MORE INFORMATIONIn general, your database grows in size as you work on the design of its objects. For example, repeated modifications to the design of a table, form, or report cause a database to grow; compacting the database restores it to a smaller size. However the growth is faster and more dramatic when you change the SQL property of a query, or if you change the SQL statement in the RecordSource property of a form or report. This is because the Jet database engine generates a new query plan each time you change the SQL, and the new plan is saved to an unused portion of your hard disk. This behavior is reported frequently in databases that use SQL pass-through queries because application developers will often modify the SQL property of a query in code to change a parameter passed to a SQL Server stored procedure, for example, or to change an Insert, Update, or Delete statement.
Steps to Reproduce BehaviorThe following example causes a database file to grow from 64 kilobytes (KB) to approximately 5564 KB. The example edits the SQL property of an SQL pass- through query 3000 times.
REFERENCESFor an example of modifying the SQL property of a pass-through query, see "Building Applications with Microsoft Access 97," Chapter 19, "Developing Client/Server Applications," pages 550-551. For more information about using parameters in pass-through queries, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q131534 TITLE : ACC: How to Simulate Parameters in an SQL Pass-Through Query |
Additional query words: SPT Grow increase Bloat Pass-Thru Thru Insert Into
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |