According to our lovely friends at Microsoft they say that after compacting a database the queries should be recompiled by opening each one then closing it. So I compacted the database I was currently working on and it was about 100 megs down to a mere 30 megs. I wrote a routine to cycle through and run each of my queries, I then watched it run lol (crapped out twice Hmmm). Looks like i need an external log to see which one it hangs on. Well after running most of the queries (and crashed lol) it is 45 megs O.K. I can deal with this I guess if it is for performance size isn't as big an issue.
My question is though according to the following article: http://support.microsoft.com/kb/209126
They mentioned several things about queries but I think they were vague. In the article they mentioned timing of a query.
There are two significant time measurements for a Select query: • Time to display the first screen of data
• Time to obtain the last record
If a query returns only one screen of data, these two time measurements are the same. If a query returns many records, these time measurements can be very different.
Then later this.
After you compact your database, run each query to compile the query so that each query will now have the updated table statistics.
So if we are opening the query to optimize it, we are doing so to update table statistics. Does this mean that we should open each query then scroll to the last record or is merely opening the query then closing it enough to fully compile it? Did I miss something in the article or are they just not very clear about this?
TIA
7 3947 NeoPa 32,556
Expert Mod 16PB
The statistics are updated whenever a query is compiled. A query is flagged for compiling when you save any changes to the query (or its underlying tables) and when the database is compacted. If a query is flagged for compiling, the compiling and the updating of statistics occurs the next time that the query is run. Compiling typically takes from one second to four seconds.
If you add a significant number of records to your database, you must open and then save your queries to recompile the queries. For example, if you design and then test a query by using a small set of sample data, you must re-compile the query after additional records are added to the database. When you do this, you want to make sure that optimal query performance is achieved when your application is in use.
From the article, I would say merely opening it and saving it would do the trick.
By the time it's shown any records it has already processed through the optimisation stage.
Interesting article. Some new info for me :)
Thanks that was the same thinking I had but not sure. It also stated that the queries that need optimization were flagged somehow but didn't say how or where this "Flag" could be found or how to access it. i am thinking it may be in a system table but not sure. This could save a LOT of time and save on the bloating issue, most of my db's have a LOT of queries some of which may take a few minutes to run.
I thought I would throw this out there in case anyone was interested. -
Public Function ComileQueries()
-
Dim Q As Object
-
Dim db As Database
-
Set db = CurrentDb
-
For Each Q In db.QueryDefs
-
If Not Q.Name Like "~*" Then
-
'Debug.Print Q.Type & " " & Q.Name
-
Select Case Q.Type
-
'Select Queries are 0 and Union queries are 128
-
Case 0, 128
-
On Error Resume Next
-
DoCmd.OpenQuery Q.Name
-
'If a table was removed and the query still refers to it a 3192 error will occur
-
If Err.Number = 3192 Then
-
Debug.Print Q.Name
-
Else
-
DoCmd.Close acQuery, Q.Name
-
End If
-
End Select
-
End If
-
Next
-
Set db = Nothing
-
End Function
-
NeoPa 32,556
Expert Mod 16PB
I don't think they wanted to publish where this extra object data is held (Essentially a dirty flag). It may be discoverable with some digging in the system tables, or even on the web maybe...
As for your routine, although you only run the safe ones (SELECT & UNION) remember that the other queries will be in the same state and will benefit from being run too (probably manually :().
According to our lovely friends at Microsoft they say that after compacting a database the queries should be recompiled by opening each one then closing it. So I compacted the database I was currently working on and it was about 100 megs down to a mere 30 megs. I wrote a routine to cycle through and run each of my queries, I then watched it run lol (crapped out twice Hmmm). Looks like i need an external log to see which one it hangs on. Well after running most of the queries (and crashed lol) it is 45 megs O.K. I can deal with this I guess if it is for performance size isn't as big an issue.
My question is though according to the following article: http://support.microsoft.com/kb/209126
They mentioned several things about queries but I think they were vague. In the article they mentioned timing of a query.
Then later this.
So if we are opening the query to optimize it, we are doing so to update table statistics. Does this mean that we should open each query then scroll to the last record or is merely opening the query then closing it enough to fully compile it? Did I miss something in the article or are they just not very clear about this?
TIA
I think you may have missed a step. In order to recompile a Query, you must:- Open the Query in Design Mode.
- Save it.
- Reexecute it.
- Simply running Queries will not recompile them.
Thanks for the input ADezii and Neopa looks like I have a little more work to do. I also found that I need to check the SQL statement for form links as well so this could get interesting. Once I get it together I will repost it and see what yall think.
NeoPa 32,556
Expert Mod 16PB I think you may have missed a step. In order to recompile a Query, you must:- Open the Query in Design Mode.
- Save it.
- Reexecute it.
- Simply running Queries will not recompile them.
Re: Point 4 - Are you sure about that ADezii?
If you refer to the quoted part of post #2 it suggests otherwise.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: JMCN |
last post by:
Here is a simple question regarding insert into and select insert into
statements. I have the follwing sql from my table make query. how
can i add other query with the same field names as tbl1? ...
|
by: noone |
last post by:
I have a database file that I use an autonumber field as the primary key
index. Because of some rearrangements in the past, this index does not match
the order that I would like it to be in, that...
|
by: Andre Laplume via AccessMonster.com |
last post by:
I have inherited a bunch of dbs which are are shared among a small group in
my dept. We typically use the dbs to write queries to extract data, usually
dumping it into Excel. Most dbs originated...
|
by: jojobar |
last post by:
Hello,
I am trying to use vs.net 2005 to migrate a project originally in vs.net
2003. I started with creation of a "web site", and then created folders for
each component of the site.
I read...
|
by: sunil |
last post by:
Hi All,
Please have a look the below program
#include<stdlib.h>
int i = system("pwd");
I compiled the above program in UNIX ,it got compiled and
executed with out any errors.It prints the...
|
by: Regnab |
last post by:
I have a table "tblSprayApplication" in a project for a nursery. Each
record refers to a single spray application across the nursery,
recording which groups had been sprayed. Multiple applications...
|
by: sam_cit |
last post by:
Hi Everyone,
I had a doubt regarding extern decleration, i tried this is one
source file,
extern int sample;
extern int sample;
int main()
{
|
by: polas |
last post by:
Good morning,
I have a quick question to clear up some confusion in my mind. I
understand that using a string literal in a declaration such as char
*p = "string literal" declares a pointer to...
|
by: bleurose |
last post by:
We have a modestly large MySQL application (about 10,000,000 rows spread over 40+ tables). Most of our queries are very small and fast (single table or two-table joins with good keys and indexes).
...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |