From: Martijn van Oosterhout <kleptog@svana.org>
To: Denis <denis@next2me.com>
Cc: pgsql-performance@postgresql.org
Cc: pgsql-general@postgresql.org
Cc: pgsql-sql@postgresql.org
Subject: Re: Yet Another (Simple) Case of Index not used
Date: Wed, 9 Apr 2003 09:46:23 +1000
Message-ID: <20030408234623.GD15928@svana.org> (raw)
In-Reply-To: <b6v9mv$1h8q$1@news.hub.org>
References: <b6v9mv$1h8q$1@news.hub.org>
On Tue, Apr 08, 2003 at 12:57:16PM -0700, Denis wrote:
> The query I am trying to do (fast) is:
>
> select count(*) from addresses;
>
> This takes more than a second to complete, because, as the 'explain' command
> shows me,
> the index created on 'addresses' is not used, and a seq scan is being used.
> One would assume that the creation of an index would allow the counting of
> the number of entries in a table to be instantanous?
Incorrect assumption. select count(*) can produce different results in
different backends depending on the current state of the active
transactions.
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/> "the West won the world not by the superiority of its ideas or values or
> religion but rather by its superiority in applying organized violence.
> Westerners often forget this fact, non-Westerners never do."
> - Samuel P. Huntington
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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: kleptog@svana.org, denis@next2me.com, pgsql-performance@postgresql.org, pgsql-general@postgresql.org
Subject: Re: Yet Another (Simple) Case of Index not used
In-Reply-To: <20030408234623.GD15928@svana.org>
* 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