Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TdiJB-0003w1-G9 for pgsql-performance@arkaria.postgresql.org; Wed, 28 Nov 2012 14:08:13 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1TdiJ9-0001hm-MG for pgsql-performance@arkaria.postgresql.org; Wed, 28 Nov 2012 14:08:11 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TdiJ8-0001hg-IY for pgsql-performance@postgresql.org; Wed, 28 Nov 2012 14:08:10 +0000 Received: from smtp2.peak6.com ([38.98.137.9]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TdiJ1-0007y3-7N for pgsql-performance@postgresql.org; Wed, 28 Nov 2012 14:08:10 +0000 X-AuditID: 0a02cb20-b7f726d000005255-8d-50b61ac0dac2 Received: from sswchi5pcas2.peak6.net (sswchi5pcas2.peak6.net [10.100.13.24]) by smtp2.peak6.com (Symantec Messaging Gateway) with SMTP id 11.DE.21077.0CA16B05; Wed, 28 Nov 2012 08:08:00 -0600 (CST) Received: from [10.10.201.64] (10.10.201.64) by sswchi5pcas2.peak6.net (10.100.13.25) with Microsoft SMTP Server (TLS) id 14.2.247.3; Wed, 28 Nov 2012 08:08:00 -0600 Message-ID: <50B61ABF.4070000@optionshouse.com> Date: Wed, 28 Nov 2012 08:07:59 -0600 From: Shaun Thomas Reply-To: Organization: Peak6 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121028 Thunderbird/16.0.2 MIME-Version: 1.0 To: =?ISO-8859-1?Q?Niels_Kristian_Schj=F8dt?= CC: Subject: Re: Optimize update query References: <1C199C0D-13DF-47B3-944A-B0560C6D2E5A@autouncle.com> In-Reply-To: <1C199C0D-13DF-47B3-944A-B0560C6D2E5A@autouncle.com> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Length: 2386 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.10.201.64] X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupjleLIzCtJLcpLzFFi42LhSuGV0D0gtS3A4NMBBYulu86yWFyfeY7Z gcmj8/B5Vo8L+6axBzBFNTDaJObl5ZcklqQqpKQWJ9sq+ReUZObnFXvklxanKrhkFifnJGbm phYpKWSm2CoZKykU5CQmp+am5pXYKiUWFKTmpSjZcSlgABugssw8hdS85PyUzLx0WyXPYH9d CwtTS11DJbt4ZJDQyZLx+ZxpwS7Bii+zu1kaGB/zdjFyckgImEis33OYGcIWk7hwbz1bFyMX h5DACUaJG5c2sUA4KxklznTPBqviFdCX6NnbAmazCKhKnJ30mx3EZhPQlZjUv4INxBYSUJHo O3uDCcTmFxCW2PehCaxeVCBMYs2eQ0wQcwQlTs58ArSAg0NEwFviV0sCSJhZQE1i7sNJrCC2 sICORNOm66wQIx0kNr2cyQJicwo4SszY+IAdot5W4sKc6ywQtrxE81aIM4WATlvRPJEN4jEF if9X3jFNYBSZhWTzLCTts5C0L2BkXsUoXlyWmJyRaVZQnFtSYKRXkJqYbaaXl1qyiREU6Uyn FXYwbu6xOsQowMGoxMPLELI1QIg1say4MvcQowQHs5IIL/MjoBBvSmJlVWpRfnxRaU5q8SFG H2CQTWSWEk3OByahvJJ4Q2NTA1NLU0NTc1NDIxzCSuK8oaGLAoQE0oGpJzs1tSC1CGYcEwen VAPjFI3vPhZP55ufsd5c9f/vTR2DuCsb27qrJXTiFpt1zl6xVzZoyd/5zhX6zAr7c09HzOUq /9dbsWPJYZmraS+d/rNmn536e9GzY7+a+FKs13fpnbvsJek5++UrOeEdK55bfus5xfdzmSCX w40XQRY3lmUk3lWp+yyQGBlrJfNclyvn/TcXTf1pSizFGYmGWsxFxYkAHK1FwCEDAAA= X-Pg-Spam-Score: -1.9 (-) 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 11/28/2012 06:57 AM, Niels Kristian Schj=F8dt wrote: Before I go crazy, here... you really need to tell us what "not enough" means. You didn't provide an explain analyze, so we don't know what your actual performance is. But I have my suspicions. > So as you can see, it's already pretty optimized, it's just not > enough :-) So what can I do? the two columns last_observed_at and > data_source_id has an index, and it is needed elsewhere, so I can't > delete those. Ok, so part of your problem is that you're tying an advertising system directly to the database for direct updates. That's a big no-no. Any time you got a huge influx of views, there would be a logjam. You need to decouple this so you can use a second tool to load the database in larger batches. You'll get much higher throughput this way. If you absolutely must use this approach, you're going to have to beef up your hardware. > PS. I'm on postgres 9.2 on a server with 32gb ram, 8 cores and two 3T > disks in a software raid 1 setup. This is not sufficient for a high-bandwidth stream of updates. Not even close. Even if those 3T disks are 7200 RPM, and even in RAID-1, you're going to have major problems with concurrent reads and writes. You need to do several things: 1. Move your transaction logs (pg_xlog) to another pair of disks entirely. Do not put these on the same disks as your data if you need high write throughput. 2. Get a better disk architecture. You need 10k, or 15k RPM disks. Starting with 6 or more of them in a RAID-10 would be a good beginning. You never told us your postgresql.conf settings, so I'm just going with very generic advice. Essentially, you're expecting too much for too little. That machine would have been low-spec three years ago, and unsuited to database use simply due to the 2-disk RAID. > Is the only way out of this really a SSD disk? No. There are many, many steps you can and should take before going this route. You need to know the problem you're solving before making potentially expensive hardware decisions. -- Shaun Thomas OptionsHouse | 141 W. Jackson Blvd. | Suite 500 | Chicago IL, 60604 312-444-8534 sthomas@optionshouse.com ______________________________________________ See http://www.peak6.com/email_disclaimer/ for terms and conditions related= to this email --=20 Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance