Re: Indices for select count(*)?

From: Nicolas Barbier <nicolas(dot)barbier(at)gmail(dot)com>
To: Alexander Scholz <alexander(dot)scholz1(at)freenet(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Indices for select count(*)?
Date: 2005-12-21 21:25:06
Message-ID: b0f3f5a10512211325q7e382bbbga81c78242fbb7313@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 12/21/05, Alexander Scholz <alexander(dot)scholz1(at)freenet(dot)de> wrote:

> Regarding the performance flow when trying to find out how many records
> are currently being stored in the table, I don't see how an index should
> help... Nevertheless we've created an unique index on "ID" but SELECT
> count("ID") from "XYZ" still takes 35 seconds*. (ID is the primary key
> basing on a sequence, select count(*) isn't faster.)

I would like to redirect you to the zillions of mailing list posts
about this subject :-).

> So - what kind of indexing would speed this up then?

None.

greetings,
Nicolas

--
Nicolas Barbier
http://www.gnu.org/philosophy/no-word-attachments.html

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Joshua D. Drake 2005-12-21 21:38:11 Re: Memory Question
Previous Message Benjamin Arai 2005-12-21 21:15:17 Memory Question