Indeces vs small tables - Mailing list pgsql-novice

From Francisco Reyes
Subject Indeces vs small tables
Date
Msg-id 20010805153025.S35112-100000@zoraida.natserv.net
Whole thread Raw
Responses Re: Indeces vs small tables  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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?




pgsql-novice by date:

Previous
From: Danny Aldham
Date:
Subject: Re: Knowing new item in table...
Next
From: Francisco Reyes
Date:
Subject: select vs varchar