X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A69BC9DCAC2 for ; Fri, 10 Mar 2006 06:48:30 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 36037-07 for ; Fri, 10 Mar 2006 06:48:32 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by postgresql.org (Postfix) with ESMTP id 4C6F39DCA55 for ; Fri, 10 Mar 2006 06:48:28 -0400 (AST) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id k2AAmR6K090463 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 10 Mar 2006 03:48:29 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.4/8.13.4) with ESMTP id k2AAmROX014612; Fri, 10 Mar 2006 03:48:27 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.4/8.13.4/Submit) id k2AAmQA5014611; Fri, 10 Mar 2006 03:48:26 -0700 (MST) (envelope-from mfuhr) Date: Fri, 10 Mar 2006 03:48:26 -0700 From: Michael Fuhr To: Ruben Rubio Rey Cc: pgsql-performance@postgresql.org Subject: Re: Query time Message-ID: <20060310104826.GA14532@winnie.fuhr.org> References: <44114F85.8020702@rentalia.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <44114F85.8020702@rentalia.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.121 required=5 tests=[AWL=0.121] X-Spam-Score: 0.121 X-Spam-Level: X-Archive-Number: 200603/118 X-Sequence-Number: 17555 On Fri, Mar 10, 2006 at 11:05:57AM +0100, Ruben Rubio Rey wrote: > Sometimes some big query takes between 5 to 15 seconds. It happens > sometimes all the day it does not depend if database is busy. > > I have measured that sentence in 15 - 70 ms in normal circunstances. Is it the *exact* same query, including the values you're querying for? The same query with different values can run with different plans depending on row count estimates. It might be useful to see the query string and the EXPLAIN ANALYZE output for a fast query and a slow one. How many tables are you querying? Might you be hitting geqo_threshold (default 12)? If so then the following thread might be helpful: http://archives.postgresql.org/pgsql-performance/2006-01/msg00132.php -- Michael Fuhr