Re: Need indexes on empty tables for good performance ?

From: Bruno Wolff III
Subject: Re: Need indexes on empty tables for good performance ?
Date: ,
Msg-id: 20050827061949.GB27248@wolff.to
(view: Whole thread, Raw)
In response to: Need indexes on empty tables for good performance ?  ("Lenard, Rohan (Rohan)")
List: pgsql-performance

Tree view

Need indexes on empty tables for good performance ?  ("Lenard, Rohan (Rohan)", )
 Re: Need indexes on empty tables for good performance ?  (Bruno Wolff III, )
 Re: Need indexes on empty tables for good performance ?  ("Thomas F. O'Connell", )
 Re: Need indexes on empty tables for good performance ?  (Chris Travers, )
 Re: Need indexes on empty tables for good performance ?  ("Lenard, Rohan (Rohan)", )
  Re: Need indexes on empty tables for good performance ?  (Chris Travers, )

On Tue, Aug 23, 2005 at 13:41:32 +1000,
  "Lenard, Rohan (Rohan)" <> 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.


pgsql-performance by date:

From: Arjen van der Meijden
Date:
Subject: Re: Inefficient queryplan for query with intersectable
From: Tom Lane
Date:
Subject: Re: Inefficient queryplan for query with intersectable