Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 67B6E1337B61 for ; Mon, 25 Apr 2011 16:01:23 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 01194-07-3 for ; Mon, 25 Apr 2011 19:01:17 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-qy0-f181.google.com (mail-qy0-f181.google.com [209.85.216.181]) by mail.postgresql.org (Postfix) with ESMTP id CDA111337C04 for ; Mon, 25 Apr 2011 16:01:08 -0300 (ADT) Received: by qyg14 with SMTP id 14so1289587qyg.19 for ; Mon, 25 Apr 2011 12:01:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=ndvxAZZS0kPozIRffsqyn2OM3Dx0b1CK7ZP8mzuASSE=; b=oGUZm46bl7iyrultXkGb6lrz4bAGT8zgh/Z59nTMOunO3hQFNIG7nqG6XB/JKsG6R3 tix0nUPnNc2M7dCdxacKo/ol+YE1kL4job831l6RASNIcImojRhllbCVov+6V6Ry2qU9 Srk+xhVjr05MZHcnCkBOemun721XjWHM23RfY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=a6EpV8sIx+Fa7aSz8neCAmExNLwp5annBEVawF7+AX7pOWMUuJVXUbGN5bo0xvmlFt gSi4IKdJQfOQF22hyaT5AtKzweJCyKRyT6d3Gct8r6J4mxqURSCnBeZ/76eKwLtkV1dW TiDRhnmToD80OHWETodxUOYANdczx4RF/txl4= MIME-Version: 1.0 Received: by 10.224.192.10 with SMTP id do10mr3099161qab.252.1303758069535; Mon, 25 Apr 2011 12:01:09 -0700 (PDT) Received: by 10.224.45.146 with HTTP; Mon, 25 Apr 2011 12:01:09 -0700 (PDT) In-Reply-To: References: <4B594466-0554-4AF8-A8BC-8FDA9C393DF9@gmail.com> Date: Mon, 25 Apr 2011 21:01:09 +0200 Message-ID: Subject: Re: big distinct clause vs. group by From: Uwe Bartels To: =?KOI8-U?B?96bUwcymyiD0yc3eydvJzg==?= Cc: Robert Haas , "pgsql-performance@postgresql.org" Content-Type: multipart/alternative; boundary=20cf3005130e9b92f004a1c2d42c X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.897 tagged_above=-10 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RFC_ABUSE_POST=0.001 X-Spam-Level: X-Archive-Number: 201104/343 X-Sequence-Number: 43405 --20cf3005130e9b92f004a1c2d42c Content-Type: text/plain; charset=KOI8-U Content-Transfer-Encoding: quoted-printable Hi Vitalii, this sounds promising, can you send me that? Best Regards, Uwe 2011/4/25 =F7=A6=D4=C1=CC=A6=CA =F4=C9=CD=DE=C9=DB=C9=CE > > > 2011/4/23 Robert Haas > >> On Apr 18, 2011, at 1:13 PM, Uwe Bartels wrote: >> > Hi Robert, >> > >> > thanks for your answer. >> > the aggregate function I was talking about is the function I need to u= se >> for the non-group by columns like min() in my example. >> > There are of course several function to choose from, and I wanted to >> know which causes as less as possible resources. >> >> Oh, I see. min() is probably as good as anything. You could also create = a >> custom aggregate that just always returns its first input. I've occasion= ally >> wished we had such a thing as a built-in. >> >> > I've once done "single" grouping function - it checks that all it's input > values are equal (non-null ones) and returns the value or raises an error= if > there are two different values. > > Best regards, Vitalii Tymchyshyn > > > > -- > Best regards, > Vitalii Tymchyshyn > --20cf3005130e9b92f004a1c2d42c Content-Type: text/html; charset=KOI8-U Content-Transfer-Encoding: quoted-printable Hi Vitalii,

this sounds promising, can you send me that?

Best= Regards,
Uwe


2011/4/25 =F7=A6=D4=C1=CC=A6=CA =F4=C9= =CD=DE=C9=DB=C9=CE <tivv00@gmail.com>


2011/4/23 Robert Haas = <robertmhaas@gmail.com>
On Apr 18, 2011, at 1:13 PM, Uwe Bartels <uwe.bartels@gmail.com> wrote:
> Hi Robert,
>
> thanks for your answer.
> the aggregate function I was talking about is the function I need to u= se for the non-group by columns like min() in my example.
> There are of course several function to choose from, and I wanted to k= now which causes as less as possible resources.

Oh, I see. min() is probably as good as anything. You could also crea= te a custom aggregate that just always returns its first input. I've oc= casionally wished we had such a thing as a built-in.


I've once done "single" grouping fu= nction - it checks that all it's input values are equal (non-null ones)= and returns the value or raises an error if there are two different values= .=9A

Best regards, Vitalii Tymchyshyn=9A



--
Best regards,
=9AVitali= i Tymchyshyn

--20cf3005130e9b92f004a1c2d42c--