pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruno Wolff III <bruno@wolff.to>
To: Lenard, Rohan (Rohan) <rlenard@avaya.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Need indexes on empty tables for good performance ?
Date: Sat, 27 Aug 2005 01:19:49 -0500
Message-ID: <20050827061949.GB27248@wolff.to> (raw)
In-Reply-To: <2773CAC687FD5F4689F526998C7E4E5F43F392@au3010avexu1.global.avaya.com>
References: <2773CAC687FD5F4689F526998C7E4E5F43F392@au3010avexu1.global.avaya.com>

On Tue, Aug 23, 2005 at 13:41:32 +1000,
  "Lenard, Rohan (Rohan)" <rlenard@avaya.com> wrote:
> I've read that indexes aren't used for COUNT(*) and I've noticed (7.3.x)
> with EXPLAIN that indexes never seem to be used on empty tables - is
> there any reason to have indexes on empty tables, or will postgresql
> never use them.

count will use indexes if appropiate. The counts themselves are NOT in the
indexes, so counts of significant fractions of a table (in particular
of the whole table) won't benefit from indexes.

You aren't going to get query speed ups by putting indexes on empty tables.
However, they may be required if you have unique or primary keys declared
in the table. You may want them to enforce some kinds of constraints.



view thread (6+ messages)  latest in thread

Message-ID: <20050827061949.GB27248@wolff.to>
Permalink:  ../20050827061949.GB27248@wolff.to/
Also on:    postgresql.org/message-id/20050827061949.GB27248@wolff.to

 · 

reply

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-performance@postgresql.org
  Cc: bruno@wolff.to, rlenard@avaya.com
  Subject: Re: Need indexes on empty tables for good performance ?
  In-Reply-To: <20050827061949.GB27248@wolff.to>

* 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