Rudolph583
New member
- Local time
- Today, 10:14
- Joined
- Jan 16, 2022
- Messages
- 5
Hi
I have run into a rather strange issue with a query and I'm wondering if any of you could think of a solution to this. I have got a SELECT query, which itself consists of several sub-queries and some of those again consist of sub-sub-queries. So overall my SELECT query has dependencies on about 20 underlying queries. All of the underlying queries are of type SELECT.
Before splitting my SELECT query into various sub-queries, my SELECT query used to be rather slow (about 2 minutes of run time). But thanks to splitting it into sub-queries it now runs very fast and now takes less than 5 seconds to execute and to display the result in the Access datasheet view. The result is about 10,000 rows across 9 different fields.
So far, so good. But when it comes to actually using the result of the SELECT query, the issues start:
1. When I want to click on the top-left arrow button in the Access datasheet view (to select all rows, aiming to copy them to the clipboard), Access seems to be re-computing the query again, but it keeps computing at high CPU load for many minutes and essentually just freezes. This is surprising, because the query result has already been computed and is already displayed in the datasheet view, so there should not be any need for Access to re-compute it. But even if for some reason it has to recompute after all, it should only take the same 5 seconds as the original computation. But it just computes for a LONG time and then just freezes and crashes.
2. Next, I tried just taking the result of the SELECT query and storing it into a temporary table so I can work with it more efficiently, without any risk of Acces re-computing the result. To do that, I have created a "Make Table" query, which creates a "SELECT * INTO MyTemporaryTable FROM NameofMySELECTQuery" type of SQL statement. While the creation of that temporary table eventually does succeed, it takes about 100 times longer than the runtime of my SELECT query. This is unexpected, because it should be almost as fast as my SELECT query, essentially a little bit of overhead for writing the result to a table, but this should add maybe 1 second of compute time for 10,000 rows, no more. Also, when the "Make Table" query is being executed, I noted that the progress bar at the bottom of Access behaves in a strange way: It keeps progressing to 100%, but then it jumps back to about 95% and then it keep jumping back and forth between 95% and 100% for several minutes until it's done.
3. I tried exporting the result of my SELECT query using the "External Data -> Export -> Excel" button in the ribbon. While it eventually does succeed, it again takes many minutes, although the SELECT query itself (before exporting) runs in less than 5 seconds.
4. Lastly, I tried building another query on top of my SELECT query. Nothing heavy, just adding a bit more data, someting that typically computes in about a second. Again the same behaviour there: Instead of the compute time for the whole thing going from, say, 3 seconds to 4 seconds, it now takes many minutes to run.
I'd be grateful for any suggestions on what could be causing this or ways to debug it. If anyhow possible, I'd like to avoid changing the structure of my SELECT query and making it less nested, because without the nesting the compute time of my SELECT query itself increases too much.
Thanks!
I have run into a rather strange issue with a query and I'm wondering if any of you could think of a solution to this. I have got a SELECT query, which itself consists of several sub-queries and some of those again consist of sub-sub-queries. So overall my SELECT query has dependencies on about 20 underlying queries. All of the underlying queries are of type SELECT.
Before splitting my SELECT query into various sub-queries, my SELECT query used to be rather slow (about 2 minutes of run time). But thanks to splitting it into sub-queries it now runs very fast and now takes less than 5 seconds to execute and to display the result in the Access datasheet view. The result is about 10,000 rows across 9 different fields.
So far, so good. But when it comes to actually using the result of the SELECT query, the issues start:
1. When I want to click on the top-left arrow button in the Access datasheet view (to select all rows, aiming to copy them to the clipboard), Access seems to be re-computing the query again, but it keeps computing at high CPU load for many minutes and essentually just freezes. This is surprising, because the query result has already been computed and is already displayed in the datasheet view, so there should not be any need for Access to re-compute it. But even if for some reason it has to recompute after all, it should only take the same 5 seconds as the original computation. But it just computes for a LONG time and then just freezes and crashes.
2. Next, I tried just taking the result of the SELECT query and storing it into a temporary table so I can work with it more efficiently, without any risk of Acces re-computing the result. To do that, I have created a "Make Table" query, which creates a "SELECT * INTO MyTemporaryTable FROM NameofMySELECTQuery" type of SQL statement. While the creation of that temporary table eventually does succeed, it takes about 100 times longer than the runtime of my SELECT query. This is unexpected, because it should be almost as fast as my SELECT query, essentially a little bit of overhead for writing the result to a table, but this should add maybe 1 second of compute time for 10,000 rows, no more. Also, when the "Make Table" query is being executed, I noted that the progress bar at the bottom of Access behaves in a strange way: It keeps progressing to 100%, but then it jumps back to about 95% and then it keep jumping back and forth between 95% and 100% for several minutes until it's done.
3. I tried exporting the result of my SELECT query using the "External Data -> Export -> Excel" button in the ribbon. While it eventually does succeed, it again takes many minutes, although the SELECT query itself (before exporting) runs in less than 5 seconds.
4. Lastly, I tried building another query on top of my SELECT query. Nothing heavy, just adding a bit more data, someting that typically computes in about a second. Again the same behaviour there: Instead of the compute time for the whole thing going from, say, 3 seconds to 4 seconds, it now takes many minutes to run.
I'd be grateful for any suggestions on what could be causing this or ways to debug it. If anyhow possible, I'd like to avoid changing the structure of my SELECT query and making it less nested, because without the nesting the compute time of my SELECT query itself increases too much.
Thanks!