View Single Post
  #2  
Old February 15th, 2007, 04:32 AM posted to microsoft.public.access.queries
kingston via AccessMonster.com
external usenet poster
 
Posts: 620
Default Ranking performance is slow

You've probably got it correct, but make sure that horizon and businessName
are indexed appropriately. Otherwise, consider using a subroutine (or update
query) to calculate the ranking first and an additional field to store the
value. It'll still take a while but should not crash anymore. HTH.


wrote:
I have successfully created a ranking subQuery, but the performance is
atrocious. Even after completing the query, scrolling through the
results causes it to freeze.

Here are the pertinent issues and goals

1) Local Data tbl has 490454 records consisting of 502 unique data
points for a main member (977 main members)
2) I created a ranking subquery that assigns 1-502 to each main
member's unique data points
3) It takes hours to complete (honestly it only completed when I did a
subset of half the members)

Here is the full SQL. Any help to improve the code or tips on
performance would be greatly appreciated!

SELECT
p.businessdate, p.horizon, p.businessName, p.closeDate,
p.i_pnlValue, p.businessID, p.f_pnlValue, p.[New PnL],
(SELECT COUNT(*)
FROM
tblCurrFI_PnL_LESS_Inv_PnL_Made_from_Query as p1
WHERE
p.horizon = p1.horizon AND
p.businessName = p1.businessName AND
p.[New PnL] = p1.[New PnL]) AS Ranking

FROM tblCurrFI_PnL_LESS_Inv_PnL_Made_from_Query AS p;


--
Message posted via
http://www.accessmonster.com