HACKER Q&A
📣 1penny42cents

What RDBMS optimizations can we do for append-only tables?


Let's say we have a table which saves immutable events. This table does not support any UPDATE statements, just INSERT and SELECT.

I can imagine that there are some optimizations we can make for such tables, since there will never be a case where a row is being updated while another query reads it. Is there a looser transaction isolation we can set? Are there any other optimizations we can do?

I understand that the optimizations may depend on the specific database. In that case, I would suggest focusing on Postgres and/or MySQL as they are the most common in my experience.


  👤 _ndianabasi Accepted Answer ✓
One of the optimisations which can be performed on such a table is indexing on single and multiple columns so that retrievals can be faster. Since there are no updates, the performance impact of re-indexing after updates is miminised.

👤 gerardnico
If there is no index, no key, no trigger, and that you have a low isolation level such as `Read uncommitted`, I really don't see what the database could do more than an insert.