Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XKT00-0005Sj-GQ for pgsql-performance@arkaria.postgresql.org; Thu, 21 Aug 2014 14:05:56 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XKSzz-0001jy-V4 for pgsql-performance@arkaria.postgresql.org; Thu, 21 Aug 2014 14:05:56 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XKSzy-0001hs-Hi for pgsql-performance@postgresql.org; Thu, 21 Aug 2014 14:05:54 +0000 Received: from smtp.optionshouse.com ([38.98.137.6] helo=smtp.peak6.com) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XKSzq-000802-0G for pgsql-performance@postgresql.org; Thu, 21 Aug 2014 14:05:53 +0000 X-AuditID: 0a64cb20-f79426d000005a0a-cb-53f5fcb899da Message-ID: <53F5FCB5.5090109@optionshouse.com> Date: Thu, 21 Aug 2014 09:05:41 -0500 From: Shaun Thomas User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Eli Naeher , pgsql-performance Subject: Re: Window functions, partitioning, and sorting performance References: In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed content-transfer-encoding: 7bit X-Originating-IP: [10.10.161.7] X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrAIsWRmVeSWpSXmKPExsXClcIrobvjz9dgg6mfJCz+XGlitbg+8xyz A5PHzll32T0u7JvGHsAU1cBok5iXl1+SWJKqkJJanGyr5F9QkpmfV+yRX1qcquCSWZyck5iZ m1qkpJCZYqtkrKRQkJOYnJqbmldiq5RYUJCal6Jkx6WAAWyAyjLzFFLzkvNTMvPSbZU8g/11 LSxMLXUNlezikUFCJ0vG4skSBds4Km7Ma2JsYHzM1sXIySEhYCIx98Z/VghbTOLCvfVAcQ4O XgF9iX+9piBhFgFViXkzu1lAbDYBXYlJ/SvAWkUFwiQezznHCGLzCghKnJz5BKxGRCBK4tLE WWC2sICfxNOvfcwgtpBAgMSFnYeZQGxOgUCJzx8vg61lFrCQWPzmIDuELS+x/e0cqHpViRXN E6HOlJfYNvs28wRG/llI1s1C0j4LSfsCRuZVjOLFZYnJGZmmBcW5JQVGegWpidlmenmpJZsY wdF2WmEH4/dOq0OMAhyMSjy8H7Z/CRZiTSwrrsw9xCjBwawkwnv/y9dgId6UxMqq1KL8+KLS nNTiQ4w+wPCYyCwlmpwPTAR5JfGGxqYGppamhqbmpoZGOISVxHkveN8KFhJIB8Z/dmpqQWoR zDgmDk6pBsaymx0tPk9KXzU8sboozzLvgGLgnl2Xdjk83bKmwun6D9XfIeEm+h4lNe4v/gjb Z+s4+188pMTt/FO2eNrdpWvO8fT9dOEOZe9V5Oj1ja0WWlzhbDLxocCxY4Y/Dqiu0S7Wcf23 gn+qxqeYp4FLZ/BFfjN8k2v04933o8XMwX/13t1Z/PTE1k1KLMUZiYZazEXFiQD6FKE+4wIA AA== X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org On 08/21/2014 08:29 AM, Eli Naeher wrote: > With around 1.2 million rows, this takes 20 seconds to run. 1.2 million > rows is only about a week's worth of data, so I'd like to figure out a > way to make this faster. Well, you'll probably be able to reduce the run time a bit, but even with really good hardware and all in-memory processing, you're not going to see significant run-time improvements with that many rows. This is one of the reasons reporting-specific structures, such as fact tables, were designed to address. Repeatedly processing the same week/month/year aggregate worth of several million rows will just increase linearly with each iteration as data size increases. You need to maintain up-to-date aggregates on the metrics you actually want to measure, so you're only reading the few hundred rows you introduce every update period. You can retrieve those kind of results in a few milliseconds. -- Shaun Thomas OptionsHouse, LLC | 141 W. Jackson Blvd. | Suite 800 | Chicago IL, 60604 312-676-8870 sthomas@optionshouse.com ______________________________________________ See http://www.peak6.com/email_disclaimer/ for terms and conditions related to this email -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance