Indeces vs small tables

From: Francisco Reyes <lists(at)natserv(dot)com>
To: Pgsql Novice <pgsql-novice(at)postgresql(dot)org>
Subject: Indeces vs small tables
Date: 2001-08-05 19:51:04
Message-ID: 20010805153025.S35112-100000@zoraida.natserv.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

For small tables, less than 100 rows, does it pay off to have an index?

I have 3 tables:
system table
system serial
name varchar(15)

heartbeat table
system integer references system table
operation integer references operation table
time timestamp

operations table
operation serial
name varchar(15)

I will be loading some log data to the heartbeat table, but the program
that produce the data will be creating something along the lines:
system1, update
system2, delete

I would use the "name" field on the system table to find the system ID and
then insert that on the heartbeat table. Likewise I would use the name
field on the operations table to find the operation ID and insert that on
the heartbeat table.

For every log entry 1 search will be performed on system and another on
operations. The question is whether an index on those two fields would
help.

Doing some explain select tests always returned a "sequential scan"
regardless of whether I had an index or not. So is it unnecessary to
create indeces for such small tables?

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Francisco Reyes 2001-08-05 20:30:10 select vs varchar
Previous Message Danny Aldham 2001-08-04 00:25:12 Re: Knowing new item in table...