0

I search a db schema to store the process tree of linux every half hour.

Platform: PostgreSQL on Linux.

I am unsure where to split all the data into columns or to use a json column.

Which one is better, and why?

3
  • 1
    Do you want to store output of the command 'ps auxf' ?
    – Sahap Asci
    May 31, 2016 at 5:57
  • I would probably store each field of the ps output as one column in a table together with a timestamp when you took the sample. That way you can do all sorts of queries on it
    – user1822
    May 31, 2016 at 6:03
  • @SahapAsci yes, I could use ps auxf. But I guess I will use the python library psutil.
    – guettli
    May 31, 2016 at 6:05

1 Answer 1

2
+50

The design should be according to your requirements. If your requirement includes to store only some columnar data that are mostly required (mostly not null) then use tables with relations (foreign keys). If you just need some logging with situational tree structure data then use JSONB. For example, suppose that you store io_counters when counters are higher than some point, then use JSON. I presuppose you use minimum postgresql 9-4.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.