pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Heikki Linnakangas <hlinnaka@iki.fi>
Cc: David Rowley <david.rowley@2ndquadrant.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: Aggregate transition state merging vs. hypothetical set functions
Date: Fri, 13 Oct 2017 12:34:11 -0400
Message-ID: <29118.1507912451@sss.pgh.pa.us> (raw)
In-Reply-To: <e80f6748-9103-971c-4abc-49c59b6ee602@iki.fi>
References: <4834.1507849699@sss.pgh.pa.us>
	<CAKJS1f9oZeDB=gxYMDDjrTg3+6MF-NxqcLp1QmGxKmR3xPXBhA@mail.gmail.com>
	<6042.1507851674@sss.pgh.pa.us>
	<e80f6748-9103-971c-4abc-49c59b6ee602@iki.fi>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

Heikki Linnakangas <hlinnaka@iki.fi> writes:
> We've been doing that window agg thing for a long time, so I think 
> "works as window agg" should be the default for regular aggregates. For 
> ordered-set aggregates, "no merging, no more transfn() calls after 
> finalfn()" seems safest.

> It's a bit of a shame to have different defaults for regular and 
> ordered-set aggregates. But that is what we implicitly assume today, 
> anyway, and it's not too that hard to document.

It's kind of a pain in the rear, really, especially for purposes like
pg_dump, which will have to know the rule to decide whether it can
omit an SMODIFY clause.  (Which it should do if the value is default,
so as not to make back-porting of dumps harder than necessary.)

On reflection though I see little choice.  Right now it's impossible
to use an OSA as a window agg at all because the parser doesn't support
that combination of options, and nodeWindowAgg is lacking necessary
support too.  If we ever get around to relaxing that, it would really
be necessary that the default for user-created OSAs be "not safe as
window agg", because almost certainly they wouldn't be.  So I think
there's no option but to have different default safety levels for OSA
and normal aggs.  As long as we're forced into that anyway, it does
make sense to default to "not safe to merge" as well.  We don't know
for sure whether there are any user-created OSAs in the wild, but
if there are, they likely borrowed code from orderedsetaggs.c.

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



view thread (12+ messages)  latest in thread

Message-ID: <29118.1507912451@sss.pgh.pa.us>
Permalink:  ../29118.1507912451@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/29118.1507912451@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, hlinnaka@iki.fi, david.rowley@2ndquadrant.com
  Subject: Re: Aggregate transition state merging vs. hypothetical set functions
  In-Reply-To: <29118.1507912451@sss.pgh.pa.us>
  References: <4834.1507849699@sss.pgh.pa.us> <CAKJS1f9oZeDB=gxYMDDjrTg3+6MF-NxqcLp1QmGxKmR3xPXBhA@mail.gmail.com> <6042.1507851674@sss.pgh.pa.us> <e80f6748-9103-971c-4abc-49c59b6ee602@iki.fi> <29118.1507912451@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox