473,789 Members | 2,774 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Query takes hours

MS Access XP, running on Win XP, Processor 2.4Ghz , 512Mb RAM, 40Gb Hard
drive

Table 1 has 167,000 records and contains the following fields
tblone_custID
tblone_easting
tblone_northing

Table 2 has 423,000 records and contains the following fields
tbltwo_custID
tbltwo_easting
tbltwo_northing

Table 1 and Table 2 does have other fields but the ones I have listed are
the key ones to explain my problem. And that problem is that table 2
contains dirty data and table 1 the good data. For both tables the CustID is
unique and there are no CustID's in table 2 that are in table 1.

I am trying to extract from table 1 good data where the easting and northing
are close so I end up with a new table returning values from table 1 and
values from table 2. That way I can then re-populate later on the results
into table 1.

The query parameters as per design view

FIELD.......... .Expr1: Abs(tblone_east ing - tbltwo_easting)
FIELD.......... .Expr2: Abs(tblone_nort hing - tbltwo_northing )

For each of these 2 fields I have a CRITERIA of "<10".

Understandably the query will take a while, upto now its been running for 9
hrs (on my spare PC at work). And what I have realised while testing on my
PC at home is that when I eventually get results I cannot export the results
without the query re-running.

So therefore;
Q1: Is there a quicker way of querying "tbltwo" against "tblone" as per my
query parameters above.
Q2: If I am lucky enough to return to work and find I have results how can I
export those results without the query re-running.

many many thanks

Macroman


Mar 21 '06 #1
4 3715
DFS
Post the SQL statement and we'll take a look.

Macroman wrote:
MS Access XP, running on Win XP, Processor 2.4Ghz , 512Mb RAM, 40Gb
Hard drive

Table 1 has 167,000 records and contains the following fields
tblone_custID
tblone_easting
tblone_northing

Table 2 has 423,000 records and contains the following fields
tbltwo_custID
tbltwo_easting
tbltwo_northing

Table 1 and Table 2 does have other fields but the ones I have listed
are the key ones to explain my problem. And that problem is that
table 2 contains dirty data and table 1 the good data. For both
tables the CustID is unique and there are no CustID's in table 2 that
are in table 1.

I am trying to extract from table 1 good data where the easting and
northing are close so I end up with a new table returning values from
table 1 and values from table 2. That way I can then re-populate
later on the results into table 1.

The query parameters as per design view

FIELD.......... .Expr1: Abs(tblone_east ing - tbltwo_easting)
FIELD.......... .Expr2: Abs(tblone_nort hing - tbltwo_northing )

For each of these 2 fields I have a CRITERIA of "<10".

Understandably the query will take a while, upto now its been running
for 9 hrs (on my spare PC at work). And what I have realised while
testing on my PC at home is that when I eventually get results I
cannot export the results without the query re-running.

So therefore;
Q1: Is there a quicker way of querying "tbltwo" against "tblone" as
per my query parameters above.
Q2: If I am lucky enough to return to work and find I have results
how can I export those results without the query re-running.

many many thanks

Macroman

Mar 21 '06 #2
Macroman wrote:
MS Access XP, running on Win XP, Processor 2.4Ghz , 512Mb RAM, 40Gb Hard
drive

Table 1 has 167,000 records and contains the following fields
tblone_custID
tblone_easting
tblone_northing

Table 2 has 423,000 records and contains the following fields
tbltwo_custID
tbltwo_easting
tbltwo_northing

Table 1 and Table 2 does have other fields but the ones I have listed are
the key ones to explain my problem. And that problem is that table 2
contains dirty data and table 1 the good data. For both tables the CustID is
unique and there are no CustID's in table 2 that are in table 1.

I am trying to extract from table 1 good data where the easting and northing
are close so I end up with a new table returning values from table 1 and
values from table 2. That way I can then re-populate later on the results
into table 1.

The query parameters as per design view

FIELD.......... .Expr1: Abs(tblone_east ing - tbltwo_easting)
FIELD.......... .Expr2: Abs(tblone_nort hing - tbltwo_northing )

For each of these 2 fields I have a CRITERIA of "<10".

Understandably the query will take a while, upto now its been running for 9
hrs (on my spare PC at work). And what I have realised while testing on my
PC at home is that when I eventually get results I cannot export the results
without the query re-running.

So therefore;
Q1: Is there a quicker way of querying "tbltwo" against "tblone" as per my
query parameters above.
Q2: If I am lucky enough to return to work and find I have results how can I
export those results without the query re-running.

many many thanks

Macroman


You didn't show a query. I am wondering if somehow you got a Cartesian
Join going or something else wrong.

You should be able to create a query something like
Select CustID, "T1" As Table, easting, northing _
From Table1
Where Abs(tblone_east ing - tbltwo_easting) < 10
Save it as query1
Now run it.
How long does it take to compute?

You should be able to write another query
Select CustID, "T2" As Table, easting, northing _
From Table2
Where Abs(tblone_east ing - tbltwo_easting) < 10
Save it as query2
Now run it.
How long does it take to compute?

Now you can create another query that Unions them
Select Query1.* From Query1
UNION ALL
Select Query2.* From Query2
and save it as Query3
Now run it.

It shouldn't take longer than running the two queries by themselves.

Mar 21 '06 #3
"Macroman" <pd*********@bt internet.com> wrote in
news:dv******** **@nwrdmz02.dmz .ncs.ea.ibs-infra.bt.com:
MS Access XP, running on Win XP, Processor 2.4Ghz , 512Mb RAM,
40Gb Hard drive

Table 1 has 167,000 records and contains the following fields
tblone_custID
tblone_easting
tblone_northing

Table 2 has 423,000 records and contains the following fields
tbltwo_custID
tbltwo_easting
tbltwo_northing

Table 1 and Table 2 does have other fields but the ones I have
listed are the key ones to explain my problem. And that
problem is that table 2 contains dirty data and table 1 the
good data. For both tables the CustID is unique and there are
no CustID's in table 2 that are in table 1.

I am trying to extract from table 1 good data where the
easting and northing are close so I end up with a new table
returning values from table 1 and values from table 2. That
way I can then re-populate later on the results into table 1.

The query parameters as per design view

FIELD.......... .Expr1: Abs(tblone_east ing - tbltwo_easting)
FIELD.......... .Expr2: Abs(tblone_nort hing - tbltwo_northing )

For each of these 2 fields I have a CRITERIA of "<10".

Understandably the query will take a while, upto now its been
running for 9 hrs (on my spare PC at work). And what I have
realised while testing on my PC at home is that when I
eventually get results I cannot export the results without the
query re-running.

So therefore;
Q1: Is there a quicker way of querying "tbltwo" against
"tblone" as per my query parameters above.
Q2: If I am lucky enough to return to work and find I have
results how can I export those results without the query
re-running.

many many thanks

Macroman

You are generating a product recordset of 167,000 x 423,000
records to be tested. That's going to take a long time.

The next time, generate a query on table one that calculates min
and max limits for your two fields. Use that query to test table
two values as between the limits in the query. This is still
slow, but faster than your way.

If you get a result set, try just copying the results to the
clipboard, if there aren't too many rows. {Ctrl-A}{Ctrl-C}, then
paste into your desired table.

saves re-running.
--
Bob Quintal

PA is y I've altered my email address.
Mar 21 '06 #4
"Macroman" <pd*********@bt internet.com> wrote in
news:dv******** **@nwrdmz02.dmz .ncs.ea.ibs-infra.bt.com:
MS Access XP, running on Win XP, Processor 2.4Ghz , 512Mb RAM, 40Gb
Hard drive

Table 1 has 167,000 records and contains the following fields
tblone_custID
tblone_easting
tblone_northing

Table 2 has 423,000 records and contains the following fields
tbltwo_custID
tbltwo_easting
tbltwo_northing

Table 1 and Table 2 does have other fields but the ones I have listed
are the key ones to explain my problem. And that problem is that table
2 contains dirty data and table 1 the good data. For both tables the
CustID is unique and there are no CustID's in table 2 that are in
table 1.

I am trying to extract from table 1 good data where the easting and
northing are close so I end up with a new table returning values from
table 1 and values from table 2. That way I can then re-populate later
on the results into table 1.

The query parameters as per design view

FIELD.......... .Expr1: Abs(tblone_east ing - tbltwo_easting)
FIELD.......... .Expr2: Abs(tblone_nort hing - tbltwo_northing )

For each of these 2 fields I have a CRITERIA of "<10".

So therefore;
Q1: Is there a quicker way of querying "tbltwo" against "tblone" as
per my query parameters above.
Q2: If I am lucky enough to return to work and find I have results how
can I export those results without the query re-running.

many many thanks

Macroman


Create indexes on the custID fields in both tables...

Then...

select t1.custid, t1.easting, t1.northing, t2.easting, t2.northing
from table1 as t1 inner join table2 as t2 on t1.custid = t2.custid
where ((t1.easting - t2.easting) between -10 and 10)
and ((t2.northing - t2.northing) between -10 and 10)

part of this is to avoid using the call to the VBA function ABS. Creating
the indexes should increase the speed of the query a bit, too. There is
not much point in indexing the easting and northing fields.

If the query is running right for you, then make a copy of the query and
make it into a "make table" query. Then export this new table instead.
and you only have to run the query once...

Mar 30 '06 #5

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

Similar topics

4
2978
by: DBNovice | last post by:
I have a database that keeps records on the issue and failure of an item. Currently, the database is poorly desisned; therefore I'm performing queries to break the data into normalized tables and attempting to perform a "left join" query to build a cross-reference table. The left join query is currently taking nearly 2 hours for MySQL to process, using Navicat as a front-end. My system specs are 1.4Mhz Pentium Processor with 1GB of RAM...
6
3284
by: Muharram Mansoorizadeh | last post by:
Hi there, I've a table with 18 millions of recordes shaped like this : Code nvarchar(80) , State int , school int , class int , Term nvarchar(80) The following query takes too long to run ( more than 2 hours ) select State , school , class , term , count (term) as freq Group by state , school , class , term How may I speed up the query? My Pc is PIV (3.6 GHz) Intell , Win2003 Server , 512 MB of RAM, 80 GB of HD Regards,
4
2023
by: ED | last post by:
I am attempting to to write a query that has a numerous nested IIf statements. The problem that I am having is that it is to long of a query to be built in design mode and when I build it in sql mode after a certain point it give me the error message that the expression is to complex. Below is the sql code that I am using (this works so far, anything added to the code will give me the to complex error message.) SELECT .WONUM, .,...
3
2091
by: Jamie Pittman via AccessMonster.com | last post by:
I am having trouble bellow wit this query. I have the total regular hours and the overtime. The problem is that if it is 8 hours and under, I need it to show as regular hours. Any thoughts? SELECT ., .Date, ., IIf(<=8,,8) AS , Sum((-)) AS Ot FROM GROUP BY ., .Date, ., IIf(<=8,,8); -- Message posted via http://www.accessmonster.com
5
5589
by: ????? | last post by:
I have an access query which gets data from a number of different tables. Although the tables have primary key fields, the order in which the records are returned means that none of these are in ascending order in the query result set. I need to include in the query a field that numbers the records in the order that they are returned. The numbers must be unique and ascending but do not necessarily have to be consecutive. For Example:
30
3399
by: Noob | last post by:
ftp://ukcassassin:winston@www.ukcassassin.pwp.blueyonder.co.uk/htdocs/Diary%20Form.bmp Hi all I will appologise in advance for my lack of knowledge of access and its working as i am quite new to the program and have been self taught, so here goes. As you can see by the image link i am creating an appointment diary for a garage,its going ok untill i created the "Hours remaing" text box The main subform adds up the hours booked in and...
3
2794
blyxx86
by: blyxx86 | last post by:
I have created a form that keeps record of a few queries that are ran. One set of queries takes 30 minutes to pull the information. The other takes about 6 minutes. I managed to use two variables to store the time before and after the queries are finished. However, I am trying to have a textbox on one of the forms count up (one second at a time) to show the elapsed time. I've tried setting up an 'OnTimer' event with TimerInterval = 1000...
1
1456
by: andet | last post by:
A simple query, doing an inner join to one table and an outer join to 2 other tables with one variable input is taking forever. I did some research and I saw that access had created 3 actual queries to DB2. One outer join and 2 full scans using the keys from the first query. If I take the SQL view of the request and paste it into DB2, the one query takes about 5 minutes. If I run this from access 2003, jet engine 4, with latest updates, on...
2
9843
by: existential.philosophy | last post by:
This is a new problem for me: I have some queries that open very slowly in design view. My benchmark query takes about 20 minutes to open in design view. That same query takes about 20 minutes to open in datasheet view. As an experiment, I deleted all rows in all tables; after that, the query took only seconds to open in both design view and datasheet view. From these facts, I conclude that Access is evaluating the query when I go to...
7
2847
by: Yesurbius | last post by:
I am receiving the following error when attempting to run my query. In my mind - this error should not be happening - its a straight-forward query with a subquery. I am using Access 2003 with all the latest patches. If I do not group the query (ie. remove aggregation) it will work. If I recall, it also works if my subquery does not have joins. I want to accomplish this with pure SQL .. I could easily write a VBA function to handle...
0
9666
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
9511
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
10199
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9983
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7529
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
6769
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
5417
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4092
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

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.