Subject Re: [firebird-support] Calculating median value on a large table
Author Alexandre Benson Smith
At 12:51 13/01/2004 +1100, you wrote:

>Hi,
>Using FirebirdCS-1.5.0.4027-RC7.i686.rpm:
>
>Suppose I have a table with 30 million records as follows:
>
>create table (
> name char(10),
> age integer
>);
>
>Can anybody suggest an efficient method of calculating the median age
>(not average) ?
>
>thanks
>bill


Hi Bill,

FB does not have statistical functions... I use to do it on the client side
(using Crystal Reports), but since I have to fetch all rows, this will be a
time consuming task, so I use to do other things just for cosmetics... like
put graphics, show top/most common values, etc.

I think the fastest way will be in a SP, in SP will be MUCH faster than
fetch all record to the client... but some statistical functions will need
to populate intermediate/temporary tables, so this could be a boring task
to code... :-(

HTH


Alexandre Benson Smith
Development
THOR Software e Comercial Ltda.
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br

----------


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.560 / Virus Database: 352 - Release Date: 08/01/2004


[Non-text portions of this message have been removed]