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?