From: Paul Thomas <paul@tmsl.demon.co.uk>
To: Fabian Kreitner <fabian.kreitner@ainea-ag.de>
Cc: pgsql-performance @ postgresql . org <pgsql-performance@postgresql.org>
Subject: Re: index / sequential scan problem
Date: Thu, 17 Jul 2003 13:34:45 +0100
Message-ID: <20030717133445.A27991@bacon> (raw)
In-Reply-To: <5.1.0.14.0.20030717131157.03957fa0@195.145.148.245>
References: <5.1.0.14.0.20030717105203.03d2b5c0@195.145.148.245>
<5.1.0.14.0.20030717105203.03d2b5c0@195.145.148.245>
<20030717111248.C27264@bacon>
<5.1.0.14.0.20030717131157.03957fa0@195.145.148.245>
On 17/07/2003 12:13 Fabian Kreitner wrote:
> That is what I read too and is why Im confused that the index is indeed
> executing faster. Can this be a problem with the hardware and/or
> postgress installation?
It's more likely that the OS has most of the data cached after the first
query and so doesn't need to re-read that data from disk when you retry
the query with seq scan disabled. Try something like this:
set enable_seqscan to true;
explain analyze ......
set enable_seqscan to false;
explain analyze ......
set enable_seqscan to true;
explain analyze ......
I expect you will find that the third query is also a lot faster that the
first query.
HTH
--
Paul Thomas
+------------------------------+---------------------------------------------+
| Thomas Micro Systems Limited | Software Solutions for the Smaller
Business |
| Computer Consultants |
http://www.thomas-micro-systems-ltd.co.uk |
+------------------------------+---------------------------------------------+
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-performance@postgresql.org
Cc: paul@tmsl.demon.co.uk, fabian.kreitner@ainea-ag.de
Subject: Re: index / sequential scan problem
In-Reply-To: <20030717133445.A27991@bacon>
References: <5.1.0.14.0.20030717105203.03d2b5c0@195.145.148.245> <20030717111248.C27264@bacon> <5.1.0.14.0.20030717131157.03957fa0@195.145.148.245> <20030717133445.A27991@bacon>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox