Skip site navigation (1) Skip section navigation (2)

Do we need multiple forms of the SQL2003 statistics aggregates?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Sergey E(dot) Koposov" <math(at)sai(dot)msu(dot)ru>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Do we need multiple forms of the SQL2003 statistics aggregates?
Date: 2006-07-27 23:22:13
Message-ID: 14099.1154042533@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: 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 the
	declared type of IVE.

	c) Case: 

	i) The declared type of REGR_COUNT is an implementation-defined
	exact numeric type with scale of 0 (zero).

	ii) Otherwise, the declared type of the result is an
	implementation-defined approximate numeric type. If DTDVE is an
	approximate numeric type, then the precision of the result is
	not less than the precision of DTDVE. If DTIVE is an approximate
	numeric type, then the precision of the result is not less than
	the 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

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2006-07-27 23:28:43
Subject: Re: GUC with units, details
Previous:From: Peter EisentrautDate: 2006-07-27 23:03:00
Subject: Re: GUC with units, details

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group