0

I am going to log some events happening in my program. My program is working on a database that I cannot change (add table). These events can be stored in a single table with no relations.

I would think, that since there are no relations, an SQL database would be a poor choice, but I am not familiar with other types. The data needs to be indexed by date, with reading speed much more important than writing. This table will grow quite big over time.

Are there better strategies / technologies to use in this situation?

3 Answers3

3

Consider writing to a log file instead of a database. While a database is great if you intend to regularly query the log for other application purposes, logging for the sake of logging is often better suited to a filesystem:

Why is filesystem preferred for logs instead of RDBMS?

With that said, there's no reason you can't have a flat table full of your events. We do it often. While NoSQL solutions might be a "better" fit, it's certainly worth considering whether it's worth the trouble to set one up if you already have a RDBMS at your disposal.

jleach
  • 2,692
  • 11
  • 27
2

You write in a comment you expect to log 100 to 500 event per day. Any kind of database or file format will be able to support this easily. So you should really choose what is simplest and most convenient for you. Which means use the same database engine you are already using in the system.

JacquesB
  • 61,955
  • 21
  • 135
  • 189
1

Are there better strategies / technologies to use in this situation?

There are NoSQL databases specifically designed to be event stores. Event Store is one example.

Of course, you can implement an event store using a relational schema. Konrad Garus describes an approach for postgresql.

VoiceOfUnreason
  • 34,589
  • 2
  • 44
  • 83