473,395 Members | 1,411 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,395 software developers and data experts.

How to fix Access Query that is running very slow?

I have two databases and I want to automate a process to find duplicates. I originally linked the table from one into the other but I have now gone down the route of importing the table from one db into the main one because it was running too slow.

Now I have imported the table I am still getting a very slow response from the query. I have tried numerous routes i.e. update, make table and even select and it is till slow. The query I am running is (will example update mode)

UPDATE tbmaindata SET tbmaindata.InChineseDB = "Y"
WHERE left(tbmaindata.add1,6) & tbmaindata.postcode = left(tbmaindata1.add1,6) & tbmaindata1.postcode;


This query no matter how I seem to do it whether it be like the example or using various queries to get the result is really slow and this process need to be automated every time the db is opened. This would take forever.

All I want to do is confirm the existence of certain records in another db. I was going to achieve this by using a macro to import the table, run query to update a column and then delete the imported table.

Can someone please help me speed this process up or point out if there is something amiss with my query.

Thanks in advance

Dave
Jan 25 '11 #1

✓ answered by code green

It's the string functions and string comparison.
The fact string manipulation is done across two databases won't help either.
Can the WHERE clause compare some numerical field instead of postcode?
If not could you add numerical comparison fields?
All I want to do is confirm the existence of certain records in another db
If this is the case, it is better to JOIN the two tables ON a suitable field, and using
WHERE field IS NOT NULL

7 22059
code green
1,726 Expert 1GB
It's the string functions and string comparison.
The fact string manipulation is done across two databases won't help either.
Can the WHERE clause compare some numerical field instead of postcode?
If not could you add numerical comparison fields?
All I want to do is confirm the existence of certain records in another db
If this is the case, it is better to JOIN the two tables ON a suitable field, and using
WHERE field IS NOT NULL
Jan 25 '11 #2
Hi Thanks for your reply, I have actually imported the table in to my main db and it is still slow. I will try your suggestion by linking the tables
Jan 25 '11 #3
TheSmileyCoder
2,322 Expert Mod 2GB
Just to have something to relate to, how many records are present in each database, and how long is it taking?

For some things/users, 3 seconds is long time, and sometimes 3 minutes is a long time, so you need to be a bit more accurate :P

Other then that "Code Green" is right, the string Manipulations are slowing you down.
Jan 25 '11 #4
There are 13,026 in one and 1,505 in the other. it was taking 15+ mins.
Jan 25 '11 #5
Hi Code Green,
You certainly pointed me in the right direction. I have used the following which appears to give me my required result.

SELECT tbmaindata.URN, tbmaindata.Add1, tbmaindata.postcode, tbMainData1.URN, tbMainData1.Add1, tbMainData1.postcode
FROM tbmaindata INNER JOIN tbMainData1 ON (tbmaindata.postcode) = tbMainData1.postcode AND (left(tbmaindata.Add1,6)) = left(tbMainData1.Add1,6);


Thanks for your help

Dave
Jan 25 '11 #6
Rabbit
12,516 Expert Mod 8TB
Indexes on postcode and Add wouldn't hurt either.
Jan 25 '11 #7
I had already indexed them but it didn't help, that was my first thought. The db is sat on a server which doesn't help. It seems to be working a treat now anyway so thanks eveyone
Jan 25 '11 #8

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

Similar topics

0
by: david liu | last post by:
access 2000 query: here's what i want to do. from an asp page, perform a search on a table in access. i have used sql code in the asp page itself, but i'd rather execute a query in access. i...
2
by: Puneet Murgai | last post by:
I am trying to run an access query which works when I write it directly in the database. However, it fails when an SQL script containing it is run from C++. It doesn't recognize the Iff and Nz...
4
by: ShastriX | last post by:
Getting a weird error while trying out a query from Access 2003 on a SQL Server 2005 table. Want to compute the amount of leave taken by an emp during the year. Since an emp might be off for...
2
by: vicky | last post by:
I have a query which runs under 15 sec. through query analyzer. But when same query is getting executed by .net console application, using ado.net, it takes 10-15 min. What can be the problem?
1
by: aps786 | last post by:
Hi, There is a table where I store ipaddress and user who logged in from that IP. I have a query to findout all ipaddresses, from where diff users had made request. stat ------------ ip...
1
by: Octoryia | last post by:
Our company has an access front end database that is used by 30+ people all day, five days a week. The issues that we are running into include the database running extremely slow, not responding, and...
3
by: austin1539 | last post by:
I am trying to run an Access query from Excel. The query, called "ProdActs1" works in Access and is run from using information from a table called "Queries". When a button is clicked in Excel, data...
3
by: =?Utf-8?B?bXNjZXJ0aWZpZWQ=?= | last post by:
Has anyone successfully used an Access query from .NET? I am trying to do this and am getting a weird error. .NET calls queries 'stored procedures'. The error I am getting says "Schema could not be...
2
by: k-man | last post by:
Hi: I have an MS Access query for a table called MyTable. One of my fields in the query is a custom field that looks like "MyField: = MyFunction(ID)" where ID is a field in MyTable. I have...
3
dlite922
by: dlite922 | last post by:
I'm building a dynamic reporting system. The report can of course query multiple tables. The query declares which tables it will access, the fields that it needs for display, and the dependent...
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: 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
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.