X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E073AD1B1F8 for ; Wed, 7 Jul 2004 17:34:17 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 24219-03 for ; Wed, 7 Jul 2004 20:34:12 +0000 (GMT) Received: from mproxy.gmail.com (rproxy.gmail.com [64.233.170.192]) by svr1.postgresql.org (Postfix) with SMTP id 43D81D1B1C8 for ; Wed, 7 Jul 2004 17:34:09 -0300 (ADT) Received: by mproxy.gmail.com with SMTP id 62so190427rni for ; Wed, 07 Jul 2004 13:33:59 -0700 (PDT) Received: by 10.38.181.19 with SMTP id d19mr148256rnf; Wed, 07 Jul 2004 13:27:19 -0700 (PDT) Message-ID: <37d451f704070713271da13629@mail.gmail.com> Date: Wed, 7 Jul 2004 15:27:19 -0500 From: Rosser Schwarz To: Edoardo Ceccarelli Subject: Re: [PERFORM] finding a max value Cc: pgsql-performance@postgresql.org, pgsql-admin@postgresql.org In-Reply-To: <40E5AE72.1080206@expot.it> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <20040702075007.B448FCF4D52@www.postgresql.com> <20040702131258.GB25007@wolff.to> <40E5AE72.1080206@expot.it> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200407/89 X-Sequence-Number: 14157 On Fri, 02 Jul 2004 20:50:26 +0200, Edoardo Ceccarelli wrote: > This is the query: > select max(KA) from annuncio > wasn't supposed to do an index scan? it takes about 1sec to get the result. > TIP 5: Have you checked our extensive FAQ? I believe this is a FAQ. See: http://www.postgresql.org/docs/faqs/FAQ.html#4.8 Try "select KA from annuncio order by KA desc limit 1;" /rls -- :wq