X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 93838CC918 for ; Thu, 17 Jul 2003 10:12:24 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 68589-06 for ; Thu, 17 Jul 2003 10:12:49 +0000 (GMT) Received: from anchor-post-31.mail.demon.net (anchor-post-31.mail.demon.net [194.217.242.89]) by svr1.postgresql.org (Postfix) with ESMTP id 682FBCAE14 for ; Thu, 17 Jul 2003 07:12:22 -0300 (ADT) Received: from tmsl-adsl.demon.co.uk ([80.177.114.181] helo=bacon.tmsl.demon.co.uk) by anchor-post-31.mail.demon.net with esmtp (Exim 3.35 #1) id 19d5ko-000OCK-0V; Thu, 17 Jul 2003 11:12:50 +0100 Date: Thu, 17 Jul 2003 11:12:48 +0100 From: Paul Thomas To: Fabian Kreitner Cc: "pgsql-performance @ postgresql . org" Subject: Re: index / sequential scan problem Message-ID: <20030717111248.C27264@bacon> References: <5.1.0.14.0.20030717105203.03d2b5c0@195.145.148.245> Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=ISO-8859-1 In-Reply-To: <5.1.0.14.0.20030717105203.03d2b5c0@195.145.148.245>; from fabian.kreitner@ainea-ag.de on Thu, Jul 17, 2003 at 10:01:18 +0100 X-Mailer: Balsa 1.2.3 Lines: 22 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/245 X-Sequence-Number: 2538 On 17/07/2003 10:01 Fabian Kreitner wrote: Hi Fabian, When you are doing these kinds of tests, you need to be aware that the kernel may have most of your data cached after the first query and this may be why the second query appears to run faster. Also don't be worried if the planner chooses a seq scan for small tables as the whole table can often be bought into memory with one IO whereas reading the index then the table would be 2 IOs. HTH -- Paul Thomas +------------------------------+---------------------------------------------+ | Thomas Micro Systems Limited | Software Solutions for the Smaller Business | | Computer Consultants | http://www.thomas-micro-systems-ltd.co.uk | +------------------------------+---------------------------------------------+