Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id D3E5EEC7B26 for ; Fri, 6 Jul 2012 08:16:51 -0300 (ADT) Received: from mail-yw0-f46.google.com ([209.85.213.46]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Sn6Wm-0000l8-Rz for pgsql-performance@postgresql.org; Fri, 06 Jul 2012 11:16:50 +0000 Received: by yhmm54 with SMTP id m54so9238949yhm.19 for ; Fri, 06 Jul 2012 04:16:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=wVJ9cdQjKDLC6PBtHbIvvbiNsz1CR4Bqn0RIS9wl4rU=; b=BWYj3XL1PZ93J2t0aONOPuaYnKYaiVc+gWkxkwkxqzunMPG++2di3pVqx/S/qbcpDP YiVVOZG8dNcrL588Ao1fS68Uj5U+TqAEZD0vH/R665K9FNMwvZUySWheaRKrwCfdRLRU 4g17ngRNVLRTz9AwSVKPamXYU2ke1a83zCh0lK7e7k3I/qXFu4/uN6GIGXST5WbRdHU9 PNCQfSVcjvAldCqkAuBhcZOxnN+87L07xBPJp0BgwTuGSCxZfPEfwX9gBPnDI4dFNLYU 5DZGgLUIuh1wn9Z1dtePmB737HB9lWvdGscotZXLeWViDsHUS6LvoOfjrsCbP9FVGrmS snmA== Received: by 10.66.84.33 with SMTP id v1mr44603881pay.44.1341573392762; Fri, 06 Jul 2012 04:16:32 -0700 (PDT) Received: from ayaki.localdomain (124-169-169-118.dyn.iinet.net.au. [124.169.169.118]) by mx.google.com with ESMTPS id rg9sm21696014pbc.67.2012.07.06.04.16.30 (version=SSLv3 cipher=OTHER); Fri, 06 Jul 2012 04:16:31 -0700 (PDT) Message-ID: <4FF6C90B.8070402@ringerc.id.au> Date: Fri, 06 Jul 2012 19:16:27 +0800 From: Craig Ringer User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120605 Thunderbird/13.0 MIME-Version: 1.0 To: Yan Chunlu CC: pgsql-performance@postgresql.org Subject: Re: how could select id=xx so slow? References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQl/jj0nDRnozJlj9prvOxmFM5J5B1giW/9+R3EWzOox3SmFNmGX79WsL0O3tREIsugxP76g X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201207/52 X-Sequence-Number: 47233 On 07/06/2012 02:17 PM, Yan Chunlu wrote: > so I wonder could this simple select is innocent and affected badly by > other queries? how could I find those queries that really slow down > the database? It might not be other queries. Your query could be taking that long because it was blocked by a lock during maintenance work (say, an ALTER TABLE). It's also quite possible that it was held up by a slow checkpoint; check your logs to see if there are warnings about checkpoint activity. -- Craig Ringer