Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id C6E1364FED1 for ; Wed, 17 Dec 2008 10:20:13 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 83541-07 for ; Wed, 17 Dec 2008 10:20:11 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-bw0-f19.google.com (mail-bw0-f19.google.com [209.85.218.19]) by mail.postgresql.org (Postfix) with ESMTP id B586064FEB3 for ; Wed, 17 Dec 2008 10:20:10 -0400 (AST) Received: by bwz12 with SMTP id 12so1073301bwz.19 for ; Wed, 17 Dec 2008 06:20:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=Gd3leFP6NVBAmlsCX0rQ7Hq2MAFQd37qjDngZHrf8z0=; b=BP/jJbGy66e3ojmJ4lthahU7/iFtgN4WEQvG7K/b1mkGPtVwqDkdfRPL0yQTNeuW6z kKG1Lj+99Agidhlm54hbMq3M30YDuK08R0/nijS/X0pFkPYW5bEsPiCixEalQDGy5zDB 822mwh/jeSY5FpmBcc3pmgMQ+UHakf45Axlxw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=g46VrGtTEP1RTr+gg0ib9NN4wE+02ahZARGbxl0x6Q6IIdaBO4OIp8r3H1VJJYekDM /ilehVs39Qaz05KqiHtIWPJde/Fzed2nYErWFJ9MMfPmg0EnxjYSiG5bYGFgnIhi3iyX YA8G5PirOWdcfPH6CZAOHMM0TFbg8crBdB0iM= Received: by 10.223.106.68 with SMTP id w4mr592549fao.20.1229523534084; Wed, 17 Dec 2008 06:18:54 -0800 (PST) Received: by 10.223.107.67 with HTTP; Wed, 17 Dec 2008 06:18:54 -0800 (PST) Message-ID: <603c8f070812170618g3116a90du94cbf102f0336d59@mail.gmail.com> Date: Wed, 17 Dec 2008 09:18:54 -0500 From: "Robert Haas" To: "Jaime Casanova" Subject: Re: measure database contention Cc: "psql performance list" In-Reply-To: <3073cc9b0812161132w3ae157a8n69e2b0cccea05ca2@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <3073cc9b0812161132w3ae157a8n69e2b0cccea05ca2@mail.gmail.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200812/160 X-Sequence-Number: 32196 On Tue, Dec 16, 2008 at 2:32 PM, Jaime Casanova wrote: > we have a some bad queries (developers are working on that), some of > them run in 17 secs and that is the average but when analyzing logs i > found that from time to time some of them took upto 3 mins (the same > query that normally runs in 17secs). > > so my question is: how could i look for contention problems? Is it the exact same query? Sometimes you might find that the query plan changes depending on the particular values you have in there; it is worth running "EXPLAIN ANALYZE" to look for such cases. You might also want to look at pg_locks. ...Robert