X-Original-To: pgsql-performance-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 044D39FB1C4 for ; Sun, 23 Jul 2006 00:51:01 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 90022-05 for ; Sun, 23 Jul 2006 00:50:55 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from linda-2.paradise.net.nz (bm-2a.paradise.net.nz [203.96.152.181]) by postgresql.org (Postfix) with ESMTP id 9A6569FAE4E for ; Sun, 23 Jul 2006 00:50:55 -0300 (ADT) Received: from smtp-3.paradise.net.nz (tclsnelb1-src-1.paradise.net.nz [203.96.152.172]) by linda-2.paradise.net.nz (Paradise.net.nz) with ESMTP id <0J2U006TS80KON@linda-2.paradise.net.nz> for pgsql-performance@postgresql.org; Sun, 23 Jul 2006 15:50:46 +1200 (NZST) Received: from [192.168.1.11] (218-101-29-211.dsl.clear.net.nz [218.101.29.211]) by smtp-3.paradise.net.nz (Postfix) with ESMTP id D6B5083DB04; Sun, 23 Jul 2006 15:39:41 +1200 (NZST) Date: Sun, 23 Jul 2006 15:39:21 +1200 From: Mark Kirkwood Subject: Re: Forcing using index instead of sequential scan? In-reply-to: To: robin.c.smith@bt.com Cc: pgsql-performance@postgresql.org Message-id: <44C2EF69.4020408@paradise.net.nz> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7bit User-Agent: Thunderbird 1.5.0.4 (X11/20060704) References: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200607/224 X-Sequence-Number: 20084 robin.c.smith@bt.com wrote: > I have been testing the performance of PostgreSQL using the simple tool > found at _http://benchw.sourceforge.net_ however I have found that all > the queries it run execute with sequential scans. The website where the > code runs has examples of the execution plan using indexes. > > When I disable the sequential plan query 0 and query 1 run faster ( > _http://benchw.sourceforge.net/benchw_results_postgres_history.html_ ) > by using the indexes as suggested by the website. > > I have tried increasing the effective_cache_size and reducing the > random_page_cost to try and force the optimiser to use the index but it > always uses the sequential scan. > > What is the best way to force the use of indexes in these queries? > Currently testing with version 8.1.4. > > Hi Robin, Being responsible for this piece of software, I should try to help, only saw this now sorry (nice to see someone using this). Unless you really want to reproduce the numbers on the website, it is best to test with Benchw's scale factor at least 2 x your physical ram, as this makes the planner's defaults work more sensibly (and models *most* real world data warehouse situations better!). Cheers Mark