X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 6BEFFD1E796 for ; Fri, 30 Apr 2004 16:49:00 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 24604-09 for ; Fri, 30 Apr 2004 16:48:41 -0300 (ADT) Received: from mail63.csoft.net (unknown [63.111.22.74]) by svr1.postgresql.org (Postfix) with SMTP id 39478D1E835 for ; Fri, 30 Apr 2004 16:48:39 -0300 (ADT) Received: (qmail 2506 invoked by uid 1112); 30 Apr 2004 19:48:32 -0000 Date: Fri, 30 Apr 2004 14:48:32 -0500 (EST) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: Gary Doades Cc: pgsql-performance@postgresql.org Subject: Re: planner/optimizer question In-Reply-To: <4092A928.27720.19838422@localhost> Message-ID: References: <409207D6.17204.170D5A52@localhost> <4092A928.27720.19838422@localhost> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200404/529 X-Sequence-Number: 6829 On Fri, 30 Apr 2004, Gary Doades wrote: > Yes, you're right and I have done this just to prove to myself that it > is the index scan that is the bottleneck. I have some complex SQL that > executes very quickly with Postgres, similar to MSSQL, but the index > scans in most of those only touch a few rows for a few loops. It seems > to be a problem when the index scan is scanning very many rows and for > each of these it has to go to the table just to find out if the index it > just looked at is still valid. > Another way to speed this up is the TODO item: "Use bitmaps to fetch heap pages in sequential order" For an indexscan that fetches a number of rows those rows may be anywhere in the base table so as each index entry is found it fetches the corresponding table row from the heap. This is not ideal because you can be jumping around in the heap and end up fetching the same page multiple times because table rows are in the same page, but were found in different places in the index. Kris Jurka