473,395 Members | 1,637 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.

Why is Access so slow for subqueries?

*** SLOW: returns a few records in 4 seconds ***
SELECT DISTINCT FIELD1, FIELD2, ...
FROM TABLE
WHERE PROJECT_ID = 1234
AND PROJECT_TYPE = 'G'
AND TASK_ID IN
(
SELECT DISTINCT PRNT_TASK_ID
FROM PROJECTS
WHERE PROJECT_ID = 1234
AND PROJECT_TYPE = 'I'
)
ORDER BY TASK_ORD;
*** BLAZING: RETURNS SAME DATA IN 1/4th of 1 second ***
SELECT DISTINCT P1.FIELD1, P1.FIELD2, ...
FROM PROJECTS P1
INNER JOIN
(
SELECT DISTINCT PRNT_TASK_ID
FROM PROJECTS
WHERE PROJECT_ID = 1234
AND PROJECT_TYPE = 'I'
) P2
ON P1.TASK_ID = P2.PRNT_TASK_ID
WHERE P1.PROJECT_ID = 1234
AND P1.PROJECT_TYPE = 'G'
ORDER BY P1.TASK_ORD;


Jun 1 '07 #1
1 2044
Baz
Good question. It just is.

"Builder" <no*****@builder.comwrote in message
news:WQ*****************@bignews2.bellsouth.net...
*** SLOW: returns a few records in 4 seconds ***
SELECT DISTINCT FIELD1, FIELD2, ...
FROM TABLE
WHERE PROJECT_ID = 1234
AND PROJECT_TYPE = 'G'
AND TASK_ID IN
(
SELECT DISTINCT PRNT_TASK_ID
FROM PROJECTS
WHERE PROJECT_ID = 1234
AND PROJECT_TYPE = 'I'
)
ORDER BY TASK_ORD;
*** BLAZING: RETURNS SAME DATA IN 1/4th of 1 second ***
SELECT DISTINCT P1.FIELD1, P1.FIELD2, ...
FROM PROJECTS P1
INNER JOIN
(
SELECT DISTINCT PRNT_TASK_ID
FROM PROJECTS
WHERE PROJECT_ID = 1234
AND PROJECT_TYPE = 'I'
) P2
ON P1.TASK_ID = P2.PRNT_TASK_ID
WHERE P1.PROJECT_ID = 1234
AND P1.PROJECT_TYPE = 'G'
ORDER BY P1.TASK_ORD;


Jun 1 '07 #2

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

Similar topics

10
by: Steve Jorgensen | last post by:
Hi all, Over the years, I have had to keep dealing with the same Access restriction - that you can't update a table in a statement that joins it to another non-updateable query or employs a...
4
by: thecrew | last post by:
I need help converting this statement to work with access 2000 SELECT COUNT(DISTINCT s.supercatID) AS num FROM supercat s WHERE s.supercatID IN (SELECT p.supercatID from Products p WHERE...
4
by: Bob Alston | last post by:
Some more, rather specific Access performance questions. IN a split front-end & back-end Access/Jet ONLY LAN situation, and with all query criteria fields and join fields indexed: 1. Is is...
5
by: mathieu.page | last post by:
Hi, I often have recursives queries in my applications, like in this simplified example : req1 : SELECT EmployeNo, EmployeName, EmployePhone FROM Employe; req2 :
10
by: Hank | last post by:
We have just recently migrated the data from our Access 2000 backend to Postgres. All forms and reports seem to run correctly but, in many cases, very slowly. We do not want to switch over until...
1
by: timn | last post by:
Translating Access SQL queries into SQL subqueries. -------------------------------------------------------------------------------- I have a query in Access that uses a subquery, I would like...
0
MMcCarthy
by: MMcCarthy | last post by:
Rather than using the Access design view change the view to SQL. I am going to attempt to outline the general syntax used for SQL queries in Access. Angle brackets <> are used in place of some...
1
NeoPa
by: NeoPa | last post by:
Access QueryDefs Mis-save Subquery SQL Access stores its SQL for Subqueries in a strange manner :s It seems to replace the parentheses "()"with square brackets "" and (often) add an extraneous...
5
by: Element | last post by:
Execution of the following statement sends Access into permanent la-la land, but works fine in SQL Server on the same table: SELECT * FROM tblDailyProofTickets WHERE TicketID NOT IN...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
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...
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.