Searing array fields - or should I redesign?
От | Bryan Montgomery |
---|---|
Тема | Searing array fields - or should I redesign? |
Дата | |
Msg-id | AANLkTikGU7aSn-eD+7u_LLwTLt7Qq_bSfA1r9Z1iQtih@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: Searing array fields - or should I redesign?
|
Список | 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.
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 по дате отправления: