Query optimisation

From: John Smith <10001_john_smith_at_hotmail.com>
Date: Wed, 6 Aug 2003 17:04:41 +0100
Message-ID: <bgr8qj$rmqsj$1_at_ID-126646.news.uni-berlin.de>



Hi, I have a small query that is running like a dead pig and wondered if anyone could help me optimise it a little.

Two tables Locations and Data
Locations has PK Location Key Id
Data has FK Location Key Id

The query

SELECT *
FROM locations
WHERE locations.[location key id]
IN
(SELECT distinct Data.[Location Key Id]
FROM Data
WHERE Data.[Customer Key Id]= " & G_Customer_Key_Id & ");"

The table Data is relatively flat with around 30 fields, locations has just 3

With 50000 records for one customer it takes around 30 seconds to process, seems far to slow.

Anyone?? Received on Wed Aug 06 2003 - 18:04:41 CEST

Original text of this message