0

I have a table where the non-primary key columns are deterministic given the primary key.

I think this could be pretty common, for example a table representing memoization/caching of an expensive function, or where the primary key is a hash of the other columns.

Further assume that the workload is mostly reads of 1-100 individual rows, and that writes can be batched or "async" based on what gives the best performance.

What are interesting tuning options on the table/database in this case?

user239558
  • 6,964
  • 1
  • 28
  • 35

1 Answers1

0

This would be an ideal candidate for index-only-scans in versions 9.2 or up, by creating an index on all the primary key columns plus the frequently queried other columns. Aggressively vacuum the table (i.e. manually after every batch update) because the default autovacuum settings are not aggressive enough to get maximal benefit from IOS.

jjanes
  • 37,812
  • 5
  • 27
  • 34