C
ChrisM
Hi, I'm trying to write a query, trouble is it is REALLY slow, in fact, I've
never actually let it run long enough to actually return any records.
The form of the query is this:
SELECT * FROM partsTable
WHERE partsTable.PART_NO IN
(
SELECT PN2 FROM PART-XREF WHERE PN1 = [RequiredPartNo]
)
So what I'm trying to do, is input a part number, run it through a query
that returns any alternative part numbers, and return any rows from the
parts table that are equivilent to the specified part number.
PART-XREF is a query, but it runs in under 1 second.
I would expect/want Access/Jet to run the sub-query first which will return
approx 1-5 rows, then simply find rows from the parts table where the part
number matches one of the those returned from the sub-query. What I suspect
it is doing is somehow running the subquery for EVERY row in the parts table
in order to check if it should include it in the result.
Anyone able to confirm or refute my theory, and more importantly, suggest
how I can get Access/Jet to run the query more efficiently??
(Parts table contains about 14,500 records.)
never actually let it run long enough to actually return any records.
The form of the query is this:
SELECT * FROM partsTable
WHERE partsTable.PART_NO IN
(
SELECT PN2 FROM PART-XREF WHERE PN1 = [RequiredPartNo]
)
So what I'm trying to do, is input a part number, run it through a query
that returns any alternative part numbers, and return any rows from the
parts table that are equivilent to the specified part number.
PART-XREF is a query, but it runs in under 1 second.
I would expect/want Access/Jet to run the sub-query first which will return
approx 1-5 rows, then simply find rows from the parts table where the part
number matches one of the those returned from the sub-query. What I suspect
it is doing is somehow running the subquery for EVERY row in the parts table
in order to check if it should include it in the result.
Anyone able to confirm or refute my theory, and more importantly, suggest
how I can get Access/Jet to run the query more efficiently??
(Parts table contains about 14,500 records.)