473,386 Members | 1,973 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

long running queries

3
I am new to access. I can work in it but don't necessarily know the correct way to do things. I am importing large tables for comparison, from 60,000 to 160,000 rows typically. I have a query where I import two files and join them by 3 fields and then link to a table and join it by one of the fields. I am left joining by one of the tables to the other. I am multiplying the price from the linked teradata table times several columns in both of the other tables. This query runs fine until I add the multiplication of the columns, then it takes forever. Also, when I get the results and try to copy them to put into excel, it never finishes or if I try to hit the buttom to see how many rows at the end of the results, it never finishes. I end up having to cancel. Can you tell me what I can do to make this run faster. When I import, I am not adding any keys because depending on what I do, sometimes it's unique by 2 columns and sometimes by 3. Also, is it better to import the data into access or link to the file? Thank you.
May 30 '07 #1
5 4058
Rabbit
12,516 Expert Mod 8TB
I am new to access. I can work in it but don't necessarily know the correct way to do things. I am importing large tables for comparison, from 60,000 to 160,000 rows typically. I have a query where I import two files and join them by 3 fields and then link to a table and join it by one of the fields. I am left joining by one of the tables to the other. I am multiplying the price from the linked teradata table times several columns in both of the other tables. This query runs fine until I add the multiplication of the columns, then it takes forever. Also, when I get the results and try to copy them to put into excel, it never finishes or if I try to hit the buttom to see how many rows at the end of the results, it never finishes. I end up having to cancel. Can you tell me what I can do to make this run faster. When I import, I am not adding any keys because depending on what I do, sometimes it's unique by 2 columns and sometimes by 3. Also, is it better to import the data into access or link to the file? Thank you.
Create indexes on all join fields. Create relationships between the tables.

Problem is when you do anything more than a select or equijoin, performance is going to suffer because it can't use an index to speed it up. So that multiplication forces it to process each record. Try a join and then a seperate query to calculate the value, I don't know if this will help but give it a shot.

When importing to excel you are most likely overloading excel. If you just let it run it would probably give you an error eventually. An excel sheet can only have about 66,000 rows of records.
May 30 '07 #2
cje
3
Create indexes on all join fields. Create relationships between the tables.

Problem is when you do anything more than a select or equijoin, performance is going to suffer because it can't use an index to speed it up. So that multiplication forces it to process each record. Try a join and then a seperate query to calculate the value, I don't know if this will help but give it a shot.

When importing to excel you are most likely overloading excel. If you just let it run it would probably give you an error eventually. An excel sheet can only have about 66,000 rows of records.

Thank you for your suggestions. I had previously broken out the queries and had the multiplication separate but it didn't help. However, I did not add indexes so I will do that. Can you tell me if I run the query to create a new database to build the next one with or do I run the next one, doing the multiplication, using the query that I saved that pulled off the appropriate data. Also, the results are less than 66,000 rows so I guess it would just take a long time to come back from what you are saying. I appreciate your help.
May 30 '07 #3
Rabbit
12,516 Expert Mod 8TB
Can you tell me if I run the query to create a new database to build the next one with or do I run the next one, doing the multiplication, using the query that I saved that pulled off the appropriate data.
I'm not sure what you mean by this.
May 30 '07 #4
cje
3
I'm not sure what you mean by this.
OK, what I mean is that when I save a query that pulls in a dataset that I have imported as a table, does the query save the results as another database or each time I run it does it create the data again. So, when I build another query from this query, is it executing the first query and creating the data again or does it have the database from the first query already created? Is this more understandable? But I don't know how to create a database from the run of the first query because all I get is a results set and I can't find an option to create a table from it. Thank you.
May 30 '07 #5
Rabbit
12,516 Expert Mod 8TB
OK, what I mean is that when I save a query that pulls in a dataset that I have imported as a table, does the query save the results as another database or each time I run it does it create the data again. So, when I build another query from this query, is it executing the first query and creating the data again or does it have the database from the first query already created? Is this more understandable? But I don't know how to create a database from the run of the first query because all I get is a results set and I can't find an option to create a table from it. Thank you.
Yes, it does rerun the query each time. So if you base a query on a query. it will run the first query, then the second query. To save the results, change the query to a make table query and then base the second query on the table it makes.
May 31 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: sqlserver yeahbaby | last post by:
I can't seem to find a step-by-step guide to how to detect or continuously monitor for long-running queries that is suitable for a comparative SQL Server novice. I know that it is possible to...
4
by: Gary | last post by:
I am having a problem executing long running queries from an ASP application which connects to SQL Server 2000. Basically, I have batches of queries that are run using ADO in a loop written in...
29
by: pb648174 | last post by:
I have a very long transaction that runs on the same database that other users need to use for existing data. I don't care if they see data from the transaction before it is done and am only using...
2
by: peteraguard-google | last post by:
Hi, I have a 120M record table that needs to have indexes added as a background process. While running the CREATE INDEX command, which is taking several days, all other SELECT queries on the...
12
by: strict9 | last post by:
Hello all, I'm writing several queries which need to do various string formating, including changing a phone number from (123) 456-7890. After some problem with data mismatches, I finally got it...
2
by: Gershon | last post by:
I have an ASP.NET/C# web application running against a SQL Server database using ADO.NET. Whenever there is a long-running database query, the web application hangs until the database query is...
4
by: ImSoLost | last post by:
I'm running a really long process from ASP.NET and need some help... I am making a method call when the user presses a button from my webpage, which goes into a database and parses a file. This...
9
by: Fish Womper | last post by:
I am at best a part time developer of Access databases. I use Access 2.0, as this is all my employer has on its computers. Even so, to use this ancient version requires a fairly convoluted...
1
by: Aaron West | last post by:
Try this script to see what queries are taking over a second. To get some real output, you need a long-running query. Here's one (estimated to take over an hour): PRINT GETDATE() select...
3
by: rfuscjr via AccessMonster.com | last post by:
This is truly bizzare. I have a query that runs for hours in one Access db. When I import it into another Access db, it runs in minutes. I compacted and repaired the original, relinked tables...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
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...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.