473,748 Members | 2,594 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Query runs long in one db, fast in another....

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 etc. Nothing makes it run faster. I
have imported the query in several dbs. I did find another where it appeared
to run very long. Still in others it runs in minutes. Ideas?

--
Message posted via AccessMonster.c om
http://www.accessmonster.com/Uwe/For...ccess/200704/1

Apr 6 '07 #1
3 2608
One thing to note here is that if it is taking Jet more than a few
seconds to process a query, then it is either time to use a bigger
engine (like sql server)

-or if this is an option -

to break down the original query into smaller queries that Jet can
handle (eliminate as many joins as you can - those are the performance
killers in Access). You will be amazed how fast Jet can process a bunch
of byte sized queries in a loop for example, instead of one huge one in
one shot.

I had a job once years ago where people were running Access queries
(with a bunch of redundant joins) against large Access tables (well,
large for Access), and the queries were taking in excess of 45 minutes
to run. Once I convinced them to upgrade to sql Server(2000), the exact
same queries (with all the same redundant joins) wrapped in sql server
stored procedures took only miliseconds to run using ADO.

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Apr 6 '07 #2
On 06 Apr 2007 21:34:15 GMT, Rich P <rp*****@aol.co mwrote:

I agree with you on redundant joins: redundancy is never a good idea.
But given a correct albeit complex query on a correct database design,
there are only very few scenarios where VBA code will be faster than a
query. That's the power of set-based instructions.

Also, another db engine with the same bad design and bad query does
not necessarily perform significantly different. I think your example
to the contrary is an exception, or was not as much the same as you're
stating here. Of course you were trying to compare apples to apples
(as much as that's possible with these two db engines) and for example
you had the Access back-end database on the local machine.

Breaking out a complex query in smaller pieces is not necessarily
going to make a difference. That's what the query processor does
anyway: get the total statement (be it from one humongous query or
from several smaller ones) and then decomposing it to come up with
smaller parts to execute. Your "hints" to Jet that you think it should
process as particular sub-queries are going to be ignored.

-Tom.

>One thing to note here is that if it is taking Jet more than a few
seconds to process a query, then it is either time to use a bigger
engine (like sql server)

-or if this is an option -

to break down the original query into smaller queries that Jet can
handle (eliminate as many joins as you can - those are the performance
killers in Access). You will be amazed how fast Jet can process a bunch
of byte sized queries in a loop for example, instead of one huge one in
one shot.

I had a job once years ago where people were running Access queries
(with a bunch of redundant joins) against large Access tables (well,
large for Access), and the queries were taking in excess of 45 minutes
to run. Once I convinced them to upgrade to sql Server(2000), the exact
same queries (with all the same redundant joins) wrapped in sql server
stored procedures took only miliseconds to run using ADO.

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Apr 7 '07 #3
Check the 'Indexes' button on the table(s) in each database you are
querying. It's possible that, if you imported the query but the tables
were already in place, that there is an index that is aiding the query
on one of the databases.

Apr 9 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
3137
by: netpurpose | last post by:
I need to extract data from this table to find the lowest prices of each product as of today. The product will be listed/grouped by the name only, discarding the product code - I use SUBSTRING(ProductName, 1, CHARINDEX('(', ProductName)-2). I can get this result, but I had to use several views (totally inefficient). I think this can be done in one efficient/fast query, but I can't think of one. In the case that one query is not...
6
561
by: Umar Farooq | last post by:
Hello all, Please bear with the long explanation of my scenario. As I'm relatively new to the query world, I like to write my queries using the visual toos such as the "View" option in SQL Server or in MS Access. If I have a complicated query with sub-queries, I create a query (view1) as (for example): select ID,count(ID) as NumberOfUsers from tblContact
2
6237
by: AG | last post by:
I am able to run a query which runs FAst in QA but slow in the application.It takes about 16 m in QA but 1000 ms on the Application.What I wanted to know is why would the query take a long time in the application when it runs fast on SQL server? How should we try debugging it? Ajay
1
2093
by: Nicolae Fieraru | last post by:
Hi All, I have a Table1 with ID, FirstName, Surname, Address1, Address2, PostCode, Suburb, Purchase. The table list all purchases made by all customers. A customer can have multiple purchases and there will be multiple records for the same customer. The address details might not be the same (for example Suburb might be W Gosford in one record and West Gosford in another record) I want to build a query which shows all the customers from...
6
3281
by: lesperancer | last post by:
SELECT distinct b.t_orno, b.t_pono FROM tblMonthlyBooking AS b, tblFilterDate, tblFilterDate AS tblFilterDate_1 WHERE (((b.t_yearMonth) Between . And .)); tblMonthlyBooking is a sql server table, 200K rows, yearMonth is an indexed long integer the primary key is t_orno, t_pono
7
3317
by: KoliPoki | last post by:
Hello every body. I have a small issue. Problem: I have a table with 4 descriptor columns (type). I need to formulate a query to retrieve a count for each type so I can group by...etc. The view I have works, but doesn't work when I supplement the query with some functions... they just don't like the UNION. The real problem is I can't change any of the udf's or queries, just the view. The view is inner joined back on to the primary...
4
3909
by: shawno | last post by:
Hello, We are currently in the process of migrating our databases from a relic of a server to a new 4 processor dual-core box with 4 gigs of RAM. Overall, database performance is obviously dramatically improved. However, I've noticed something odd with some of our larger tables (which have between 1 and 1.5 million records). Performance can differ greatly when performing simple LIKE queries such as the following: select record_id...
8
6491
by: SaltyBoat | last post by:
Needing to import and parse data from a large PDF file into an Access 2002 table: I start by converted the PDF file to a html file. Then I read this html text file, line by line, into a table using a code loop and an INSERT INTO query. About 800,000 records of raw text. Later, I can then loop through and parse these 800,000 strings into usable data using more code. The problem I have is that the conversion of the text file, using a...
1
1781
by: gkinu | last post by:
I have 2 tables with a parent-child relationship. Parent table's primary key field is Entry_no and is of type VarChar(50). This parent table has about 50 fields. The child has 3 fields, Entry_No (varchar(50), Requestor char(3) and id (integer). I need the following query QUERY 1. select p.entry_no, p.reg_date from tparent p, tchild c where p.entry_no<>c.entry_no and c.requestor='KPA' order by p.reg_date, p.entry_no; The above query...
0
8996
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8832
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9562
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9333
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6799
isladogs
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6078
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3319
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.