X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 902C8D1B229 for ; Thu, 5 Aug 2004 10:18:49 -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 47793-07 for ; Thu, 5 Aug 2004 13:18:50 +0000 (GMT) Received: from tht.net (vista.tht.net [216.126.88.2]) by svr1.postgresql.org (Postfix) with ESMTP id 08043D1B171 for ; Thu, 5 Aug 2004 10:18:45 -0300 (ADT) Received: from [134.22.68.4] (dyn-68-4.tor.dsl.tht.net [134.22.68.4]) by tht.net (Postfix) with ESMTP id 3787976AF2; Thu, 5 Aug 2004 09:18:50 -0400 (EDT) Subject: Re: [GENERAL] Tuning queries on large database From: Rod Taylor To: Valerie Schneider DSI/DEV Cc: Christopher Kings-Lynne , Postgresql Performance In-Reply-To: <200408050816.i758GxO21560@mu.meteo.fr> References: <200408050816.i758GxO21560@mu.meteo.fr> Content-Type: text/plain Message-Id: <1091711927.84496.22.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Thu, 05 Aug 2004 09:18:47 -0400 Content-Transfer-Encoding: 7bit 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: 200408/64 X-Sequence-Number: 7700 > so it takes about 28 Gb instead of 68 Gb ! Huzzah! > For my different queries, it's better but less performant than oracle : Not surprising. Oracle has a number of optimizations that we don't have implemented at this point, particularly where aggregates are involved. One that PG could use, particularly for Q4, is the ability to execute a selective sequential scan based on a read of the index -- right now it pulls in actual data from the table structure while following the index -- creates unnecessary disk-head movement. The only solution to that, at the moment, is to cluster the table by pk_data. I am curious though, could you run the below query on both systems and report back times? select 'Q4', * from data where num_poste between 600 and 625; I'm wondering if Oracle is using a shortcut since the count(*) doesn't actually require the data -- just knowledge of whether a matching row exists or not.