B
Bob
microsoft . public . access . queries
sub: why isn't this query FAST!? I've tried EVERYTHING!
running access 2k; in frontend-backend configuration.
backends look like this: (FWIW- this representation is vastly
simplified for discussion, so don't try to make sense of a topology
that looks strange (naturally, all tables contain MANY more
fields)
invtrack.mdb
T_inv_log
PK case_id (text,10; no dup)
T_inv_conv
PK ID (long auto; no dup)
IX case_id (text,10; dup ok)
IX box_id (text,10; dup ok)
sales.mdb
T_ord_det
PK ord_num (long; dup ok)
PK item_no (long auto; no dup)
IX item_id (text,10; no dup)
IX item_code (text,10; dup ok)
T_inv_mast
PK item_code (text,10; no dup)
item_name (text)
Now - the front-end app has links to tables in both back-ends.
ALL subdatasheet names are set to none - even the linked one's in the
front-end.
I can do a query (select *) for each of the 4 tables, and (no
surprise) they run INSTANTLY.
My problem query has the general config of:
T_inv_log T_inv_conv T_ord_det T_inv_mast
case_id--------(>)case_id item_code-------->item_code
box_id---------->item_id item_name
if I run the following query - IT TAKES FOREVER!!
SELECT T_inv_log.*, T_inv_mast.item_name
FROM (T_inv_log INNER JOIN T_inv_conv ON
T_inv_log.case_id = T_inv_conv.case_id) LEFT JOIN
(T_inv_mast RIGHT JOIN T_ord_det ON
T_inv_mast.item_code = T_ord_det.item_code) ON
T_inv_conv.box_id = T_ord_det.item_id;
If I remove the last (or first) table - it still takes forever to run:
SELECT T_inv_log.*
FROM (T_inv_log INNER JOIN T_inv_conv ON
T_inv_log.case_id = T_inv_conv.case_id) LEFT JOIN
T_ord_det ON T_inv_conv.box_id = T_ord_det.item_id;
But - the first 2 tables alone runs instantly: (as do the last 2
tables, AND middle 2)
SELECT T_inv_log.*
FROM T_inv_log INNER JOIN T_inv_conv ON
T_inv_log.case_id = T_inv_conv.case_id;
I have tried just about EVERY permutation I can think of:
- different joins (outer's, inner's) in different combinations.
- placing various table sets in sub-query's within the same query.
- placing various table sets in separate query's.
Whatever arrangement I've tried - the FINAL query STILL TAKES FOREVER
TO RUN????
can anyone PLEASE offer a suggestion or idea as to why this is sooooo
slow!?!?
TIA - Bob
PS-
upset that this posts w/ a kerned font - had this perfectly formated
for fixed font
sub: why isn't this query FAST!? I've tried EVERYTHING!
running access 2k; in frontend-backend configuration.
backends look like this: (FWIW- this representation is vastly
simplified for discussion, so don't try to make sense of a topology
that looks strange (naturally, all tables contain MANY more
fields)
invtrack.mdb
T_inv_log
PK case_id (text,10; no dup)
T_inv_conv
PK ID (long auto; no dup)
IX case_id (text,10; dup ok)
IX box_id (text,10; dup ok)
sales.mdb
T_ord_det
PK ord_num (long; dup ok)
PK item_no (long auto; no dup)
IX item_id (text,10; no dup)
IX item_code (text,10; dup ok)
T_inv_mast
PK item_code (text,10; no dup)
item_name (text)
Now - the front-end app has links to tables in both back-ends.
ALL subdatasheet names are set to none - even the linked one's in the
front-end.
I can do a query (select *) for each of the 4 tables, and (no
surprise) they run INSTANTLY.
My problem query has the general config of:
T_inv_log T_inv_conv T_ord_det T_inv_mast
case_id--------(>)case_id item_code-------->item_code
box_id---------->item_id item_name
if I run the following query - IT TAKES FOREVER!!
SELECT T_inv_log.*, T_inv_mast.item_name
FROM (T_inv_log INNER JOIN T_inv_conv ON
T_inv_log.case_id = T_inv_conv.case_id) LEFT JOIN
(T_inv_mast RIGHT JOIN T_ord_det ON
T_inv_mast.item_code = T_ord_det.item_code) ON
T_inv_conv.box_id = T_ord_det.item_id;
If I remove the last (or first) table - it still takes forever to run:
SELECT T_inv_log.*
FROM (T_inv_log INNER JOIN T_inv_conv ON
T_inv_log.case_id = T_inv_conv.case_id) LEFT JOIN
T_ord_det ON T_inv_conv.box_id = T_ord_det.item_id;
But - the first 2 tables alone runs instantly: (as do the last 2
tables, AND middle 2)
SELECT T_inv_log.*
FROM T_inv_log INNER JOIN T_inv_conv ON
T_inv_log.case_id = T_inv_conv.case_id;
I have tried just about EVERY permutation I can think of:
- different joins (outer's, inner's) in different combinations.
- placing various table sets in sub-query's within the same query.
- placing various table sets in separate query's.
Whatever arrangement I've tried - the FINAL query STILL TAKES FOREVER
TO RUN????
can anyone PLEASE offer a suggestion or idea as to why this is sooooo
slow!?!?
TIA - Bob
PS-
upset that this posts w/ a kerned font - had this perfectly formated
for fixed font