Re: Range query optimization help?
From: Gert-Jan Strik (sorry_at_toomuchspamalready.nl)
Date: 07/14/04
- Next message: Mamun: "splitting data into several fields"
- Previous message: Dave F: "Re: Last day of the month"
- In reply to: Mischa Sandberg: "Re: Range query optimization help?"
- Next in thread: Gert-Jan Strik: "Re: Range query optimization help?"
- Reply: Gert-Jan Strik: "Re: Range query optimization help?"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 14 Jul 2004 22:05:09 +0200
Mischa Sandberg wrote:
<snip>
> Gert-Jan Strik's solution completed on my test DB in <3hours,
> instead of the 10+ hours that the naive query took. So that's good.
> The query plan suggests that it's looking at multiple StdAmp rows
> in the subquery, instead of just homing in on the max value
> in the index as you'd expect. Will tinker.
<snip>
> I failed to mention that MeterEvents really has
> 18 other unindexed fields, all but one being NOT NULL.
<snip>
Well, since your problem is a common range lookup problem, the query was
the easy first step. Now up to the next step...
It may sound silly, but you may want to create a nonclustered unique
index on StdAmp(src,minamp), in addition to your already existing
clustered index on these columns.
If this index is not automatically used in the correlated subquery, then
add an index hint there.
Maybe this will only hurt performance, but it is worth a try.
Good luck,
Gert-Jan
-- (Please reply only to the newsgroup)
- Next message: Mamun: "splitting data into several fields"
- Previous message: Dave F: "Re: Last day of the month"
- In reply to: Mischa Sandberg: "Re: Range query optimization help?"
- Next in thread: Gert-Jan Strik: "Re: Range query optimization help?"
- Reply: Gert-Jan Strik: "Re: Range query optimization help?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|