Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d6b7A-0008Il-2s for pgsql-admin@arkaria.postgresql.org; Fri, 05 May 2017 11:09:36 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1d6b79-0000mf-FJ for pgsql-admin@arkaria.postgresql.org; Fri, 05 May 2017 11:09:35 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1d6b6y-0000Xw-Un for pgsql-admin@postgresql.org; Fri, 05 May 2017 11:09:25 +0000 Received: from m12-15.163.com ([220.181.12.15]) by magus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d6b6q-0001ou-S1 for pgsql-admin@postgresql.org; Fri, 05 May 2017 11:09:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=Subject:From:Message-ID:Date:MIME-Version; bh=5zYvN WdZVk2cWSik4VpacBzXQDQdu7NQ5yKSPYfEDOM=; b=CmpSzKG+SC2RLbNScKOXu XdsCu6kPa5GWVpHrPCDS2TYgiTTSWwOcIRUBaZLTkuBPmJpiJjKaqJdeWuhqCV/k 8Ge9oZ9cAGQhD9YTaAXTYmwKLN1AEOXPhpR34BxE8DdhSQhwm0U9/nyPW87ql9r3 njH2l/z0bWf8oZWmUk2c6k= Received: from winstondeMacBook-Pro.local (unknown [1.180.215.84]) by smtp11 (Coremail) with SMTP id D8CowADnnWpWXQxZuMoPDw--.3890S2; Fri, 05 May 2017 19:09:12 +0800 (CST) Subject: Re: windown function count Unexpected results To: pgsql-admin@postgresql.org References: From: winston cheung Message-ID: <13010b9e-7d51-c17a-1202-7cc084df7d9e@163.com> Date: Fri, 5 May 2017 19:10:04 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------31EC3BEA98434F5F06E733C0" X-CM-TRANSID: D8CowADnnWpWXQxZuMoPDw--.3890S2 X-Coremail-Antispam: 1Uf129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7v73 VFW2AGmfu7bjvjm3AaLaJ3UbIYCTnIWIevJa73UjIFyTuYvjxUqT7KUUUUU X-Originating-IP: [1.180.215.84] X-CM-SenderInfo: pzlq23prqbuxphxqwqqrwthudrp/xtbByhjOmlO+op9Q5AAAsi X-Pg-Spam-Score: -1.7 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org This is a multi-part message in MIME format. --------------31EC3BEA98434F5F06E733C0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit thanks a lot,steven,david :-) 在 5/5/17 13:14, Steven Chang 写道: > Hello, > > Official document in > https://www.postgresql.org/docs/9.3/static/functions-window.html says > so : > An aggregate used with ORDER BY and the default window frame > definition produces a "running sum" type of behavior, which may or may > not be what's wanted. To obtain aggregation over the whole partition, > omit ORDER BY or use ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED > FOLLOWING winston , regards --------------31EC3BEA98434F5F06E733C0 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit

thanks a lot,steven,david :-)


在 5/5/17 13:14, Steven Chang 写道:
Hello,

     Official document in https://www.postgresql.org/docs/9.3/static/functions-window.html says so   :
An aggregate used with ORDER BY and the default window frame definition produces a "running sum" type of behavior, which may or may not be what's wanted. To obtain aggregation over the whole partition, omit ORDER BY or use ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING

winston , regards
--------------31EC3BEA98434F5F06E733C0--