X-Original-To: pgsql-performance-postgresql.org@postgresql.org Received: from localhost (unknown [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 634529FB298 for ; Wed, 30 Aug 2006 09:04:04 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 19638-09 for ; Wed, 30 Aug 2006 09:03:54 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from relay01.is.co.za (relay01.is.co.za [196.35.6.69]) by postgresql.org (Postfix) with ESMTP id 8AC7E9FB273 for ; Wed, 30 Aug 2006 09:03:53 -0300 (ADT) Received: from relay01.is.co.za (localhost [127.0.0.1]) by relay01.is.co.za (Postfix) with ESMTP id A0F113153BD for ; Wed, 30 Aug 2006 14:03:51 +0200 (SAST) Received: from smtp02.isdsl.net (smtp02.isdsl.net [196.26.208.200]) by relay01.is.co.za (Postfix) with ESMTP id 6F3D8315315 for ; Wed, 30 Aug 2006 14:03:51 +0200 (SAST) Received: from server.svo.co.za (c1-52-10.rrba.isadsl.co.za [196.209.57.52]) by smtp02.isdsl.net (Postfix) with ESMTP id 35F312E1F1 for ; Wed, 30 Aug 2006 14:03:51 +0200 (SAST) Received: from [192.168.0.11] ([192.168.0.11]) by server.svo.co.za with Microsoft SMTPSVC(6.0.3790.1830); Wed, 30 Aug 2006 14:08:13 +0200 Message-ID: <44F57E9F.2020604@studentvillage.co.za> Date: Wed, 30 Aug 2006 14:03:43 +0200 From: Willo van der Merwe User-Agent: Thunderbird 1.5.0.5 (Windows/20060719) MIME-Version: 1.0 To: Alex Hayward Cc: pgsql-performance@postgresql.org Subject: Re: PostgreSQL performance issues References: <44F446B2.2090900@studentvillage.co.za> <44F56649.9050604@studentvillage.co.za> <000801c6cc2b$fcb9e8a0$0a00a8c0@svo.co.za> In-Reply-To: <000801c6cc2b$fcb9e8a0$0a00a8c0@svo.co.za> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 30 Aug 2006 12:08:13.0812 (UTC) FILETIME=[F8019B40:01C6CC2C] X-Virus-Scanned: ClamAV using ClamSMTP at relay01.dial-up.net X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.09 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO, ROUND_THE_WORLD X-Spam-Level: * X-Archive-Number: 200608/473 X-Sequence-Number: 20658 Alex Hayward wrote: > On Wed, 30 Aug 2006, Willo van der Merwe wrote: > > >> Merlin Moncure wrote: >> >>> On 8/29/06, Willo van der Merwe wrote: >>> >>> >>>> and it has 743321 rows and a explain analyze select count(*) from >>>> property_values; >>>> >>>> >>> you have a number of options: >>> >> All good ideas and I'll be sure to implement them later. >> >> >>> I am curious why you need to query the count of records in the log >>> table to six digits of precision. >>> >> I'm not with you you here. >> I'm drawing statistic for the my users on a per user basis in real-time, >> so there are a couple of where clauses attached. >> > > Most of the advice so far has been aimed at improving the performance of > the query you gave. If this query isn't representative of your load then > you'll get better advice if you post the queries you are actually making > along with EXPLAIN ANALYZE output. > > >> Hi Merlin, >> >> This was just an example. All queries have slowed down. Could it be that >> I've reached some cut-off and now my disk is thrashing? >> >> Currently the load looks like this: >> Cpu0 : 96.8% us, 1.9% sy, 0.0% ni, 0.3% id, 0.0% wa, 0.0% hi, 1.0% si >> Cpu1 : 97.8% us, 1.6% sy, 0.0% ni, 0.3% id, 0.0% wa, 0.0% hi, 0.3% si >> Cpu2 : 96.8% us, 2.6% sy, 0.0% ni, 0.3% id, 0.0% wa, 0.0% hi, 0.3% si >> Cpu3 : 96.2% us, 3.2% sy, 0.0% ni, 0.3% id, 0.0% wa, 0.0% hi, 0.3% si >> > > It seems to be a sort of standing assumption on this list that databases > are much larger than memory and that database servers are almost always IO > bound. This isn't always true, but as we don't know the size of your > database or working set we can't tell. You'd have to look at your OS's IO > statistics to be sure, but it doesn't look to me to be likely that you're > IO bound. > > If there are significant writes going on then it may also be interesting > to know your context switch rate and whether dropping your foreign key > constraint makes any difference. IIRC your foreign key constraint will > result in the row in log_sites being locked FOR UPDATE and cause updates > and inserts into your log table for a particular site to be serialized (I > may be out of date on this, it's a while since I heavily used foreign > keys). > > ---------------------------(end of broadcast)--------------------------- > TIP 1: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly > Hi Alex, Yes, I haven't noticed any major I/O waits either. The crazy thing here is that all the queries were running an an acceptable time limit, but then suddenly it went haywire. I did not change any of the queries or fiddle with the server in any way. Previously we've experienced 1 or 2 spikes a day (where load would suddenly spike to 67 or so, but then quickly drop down to below 4) but in this case it stayed up. So I restarted the service and started fiddling with options, with no apparent effect.