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 943B0D1B33F for ; Fri, 2 Jul 2004 15:54:53 -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 11865-06 for ; Fri, 2 Jul 2004 18:54:52 +0000 (GMT) Received: from smtp2.aruba.it (smtp2.aruba.it [62.149.128.201]) by svr1.postgresql.org (Postfix) with SMTP id 14440D1B172 for ; Fri, 2 Jul 2004 15:54:48 -0300 (ADT) Received: (qmail 6320 invoked from network); 2 Jul 2004 18:50:16 -0000 Received: from unknown (HELO ?192.168.0.69?) (80.183.237.107) by smtp2.aruba.it with SMTP; 2 Jul 2004 18:50:16 -0000 Message-ID: <40E5AE72.1080206@expot.it> Date: Fri, 02 Jul 2004 20:50:26 +0200 From: Edoardo Ceccarelli Organization: EXPOT User-Agent: Mozilla Thunderbird 0.6 (Windows/20040502) X-Accept-Language: en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Cc: pgsql-admin@postgresql.org Subject: finding a max value References: <20040702075007.B448FCF4D52@www.postgresql.com> <20040702131258.GB25007@wolff.to> In-Reply-To: <20040702131258.GB25007@wolff.to> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Rating: smtp2.aruba.it 1.6.2 0/1000/N X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.2 tagged_above=0.0 required=5.0 tests=RCVD_IN_NJABL, RCVD_IN_SORBS X-Spam-Level: X-Archive-Number: 200407/100 X-Sequence-Number: 14168 This is the query: select max(KA) from annuncio field KA is indexed and is int4, explaining gives: explain select max(KA) from annuncio; QUERY PLAN ----------------------------------------------------------------------- Aggregate (cost=21173.70..21173.70 rows=1 width=4) -> Seq Scan on annuncio (cost=0.00..20326.76 rows=338776 width=4) (2 rows) wasn't supposed to do an index scan? it takes about 1sec to get the result.