Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: one for the SQL experts - dare I say TRICKY SQL!

Re: one for the SQL experts - dare I say TRICKY SQL!

From: Hugo Kornelis <hugo_at_perFact.REMOVETHIS.info.INVALID>
Date: Wed, 08 Feb 2006 00:12:12 +0100
Message-ID: <no9iu1tb0pg6e7u3ds3m54jeljkig1tbk2@4ax.com>


On 7 Feb 2006 08:40:14 -0800, paulspratley_at_yahoo.co.uk wrote:

>There are 2 occassions when the user count is 1 at the start of
>Threadid 1 and when the last thread 4 is kicked off. Threadid has 2 *
>10 (measurements) = 20 and Threadid 4 has 2 * 40 (measurements).
>Therefore 100 measurements in total. Two threads therefore average =
>50.

Hi paulspratley,

I still can't figure this one out.

First, I'm surprised that you want to factor in both measurements of thread 1. After all, one of those measurements was taken when a total of two threads was running. The initial post by Graham suggests to me that this measurement should not be used here. But maybe I'm misreading the vague description Graham posted?

Second, with the logic outline above, I can explain the first line of the expected results, but neither the second, not the third.

>Count of Users Avg Rsp Time
>1 50
>2 30
>3 40

There are two active threads when during the lifecycle of thread 2 (overlaps with 1) and 3 (overlaps with 1 as well). According to the logic above, we'll have to use 2*10=20 for thread 1, 2*20=40 for thread 2, and 2*30=60 for thread 3. A total of 120, for three threads - this averages out to 40, not 30 as you state in the expected results.

There isn't even one single occasion with three (or more) threads simultaneously active. So where does the third row come from?

BTW, You posted to both SQL Server and Oracle groups - what DB are you actually running on? These DBMSes are not 100% compatible.

-- 
Hugo Kornelis, SQL Server MVP
Received on Tue Feb 07 2006 - 17:12:12 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US