Searing array fields - or should I redesign? - Mailing list pgsql-general

From Bryan Montgomery
Subject Searing array fields - or should I redesign?
Date
Msg-id AANLkTikGU7aSn-eD+7u_LLwTLt7Qq_bSfA1r9Z1iQtih@mail.gmail.com
Whole thread Raw
Responses Re: Searing array fields - or should I redesign?  (Jan Kesten <jan@dafuer.de>)
List pgsql-general
Hello,
I have a process that is logging data from vehicles. I'm looking for thoughts on the pros and cons of different approaches to storing this data - and retrieving it. Different vehicles report different types of data. The current process stores the data in a multi-dimensional array.

eg, insert into logtable values ( 'vehicle123', now(), {{'voltage','13'},{'rpm','600'}};

However, I am not sure how I can write a query - for example to read all records where the voltage field is less than 13. Performance in this case is not a real significant issue.

Would I be better off redesigning and having a master / detail kind of structure? Where the master table would have the vehicle id, timestamp and a key to the detail table. The detail table would then have the key, the type of measurement and then the value.

I guess a third approach would be to just have the detail table with duplication on the vehicle id and time - for each data type recorded.

Thanks,
Bryan.

pgsql-general by date:

Previous
From: Merlin Moncure
Date:
Subject: Re: Fast Insert and Update (through COPY)
Next
From: Jan Kesten
Date:
Subject: Re: Searing array fields - or should I redesign?