Re: run multiple queries in access
- From: salad <oil@xxxxxxxxxxx>
- Date: Thu, 14 Sep 2006 20:52:12 GMT
zwasdl@xxxxxxxxx wrote:
Some of my queries take 1 hour to run, can I run other queries in
access while waiting on the first query? If so, how can I do it?
Thanks a lot,
Wei
Can you tell us why a query takes 1 hour to run? Is it due to extremely large tables?
Some things to speed up a query are indexes. Let's say you have an Orders table and an Employee table. The employee table's key is EmpID. The order table has EmpID for the person who took the order. The EmpID should be indexed.
Also, fields that are commonly filtered (see Where clause) should be indexed. "Where OrderDate = Date()"...index on OrderDate.
Now, some will disagree with me here, but SubSelects suck wind big time 99% of the time. And I'd almost wager you have a subselect or two in your query.
I might take a look at your query and see if I could create another query that you get a list small. Ex:
Select Orders.* From Orders Where OrderDate = Date()
and save that as Query1
Now create a new query. Add Query1 and link to other tables or queries and save as Query2.
It's possible that other tables you are linking to can also be made into other queries that produce smaller recordsets. I would study your query and determine if you can make other parts of the query separate queries themselves. I've taken queries that take 1/2 - 1 hour to calc down to seconds using the above concept.
In one of those long ones I created QueryStep1 to create a smaller subset. Then had a QueryStep2 using QueryStep1 to get a smaller set then had a QueryStep3 using QueryStep2 and then finally a QueryStep4 using QueryStep3. Going from a long calc to one done in a second or 2 is worth the effort.
.
- References:
- run multiple queries in access
- From: zwasdl
- run multiple queries in access
- Prev by Date: Re: Date Range but for Current Year
- Next by Date: Re: Is there any way to find out the width of a closed report programatically?
- Previous by thread: Re: run multiple queries in access
- Next by thread: How to stop a running query? esc, crtl+break do not work
- Index(es):
Relevant Pages
|