Do we need multiple forms of the SQL2003 statistics aggregates? - Mailing list pgsql-hackers

From Tom Lane
Subject Do we need multiple forms of the SQL2003 statistics aggregates?
Date
Msg-id 14099.1154042533@sss.pgh.pa.us
Whole thread Raw
Responses Re: Do we need multiple forms of the SQL2003 statistics aggregates?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Sergey's recent patch for the SQL2003 binary aggregates implements each
of them three times: in float4, float8, and numeric arithmetic.  This
seems like vast overkill.  The float4 versions certainly ought to go,
as they won't perform noticeably better than float8 and will likely be
subject to terrible roundoff-error problems.  I'm also dubious about the
numeric versions.  The spec says
b) Let DTDVE be the declared type of DVE and let DTIVE be thedeclared type of IVE.
c) Case: 
i) The declared type of REGR_COUNT is an implementation-definedexact numeric type with scale of 0 (zero).
ii) Otherwise, the declared type of the result is animplementation-defined approximate numeric type. If DTDVE is
anapproximatenumeric type, then the precision of the result isnot less than the precision of DTDVE. If DTIVE is an
approximatenumerictype, then the precision of the result is not less thanthe precision of DTIVE.
 

so as far as I can see we are *only* required to provide a float8
implementation.

There is room to argue that the numeric-arithmetic version would be
worth having on the grounds of greater precision or range, but it's a
big chunk of code and the public demand for the functionality has not
exactly been overwhelming.

Comments?
        regards, tom lane


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: GUC with units, details
Next
From: Tom Lane
Date:
Subject: Re: GUC with units, details