Re: Searing array fields - or should I redesign?
| От | Jan Kesten |
|---|---|
| Тема | Re: Searing array fields - or should I redesign? |
| Дата | |
| Msg-id | 995BA02F-7F35-4E41-A7A8-2D06DDF3E722@dafuer.de обсуждение исходный текст |
| Ответ на | Searing array fields - or should I redesign? (Bryan Montgomery <monty@english.net>) |
| Ответы |
Re: Searing array fields - or should I redesign?
|
| Список | pgsql-general |
> 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
thevehicle id, timestamp and a key to the detail table.
The second approach would work quite well.
table logentry
id primary unique
vehicleid int
logtime timestamp
table logdetail
logid int
attribute varchar/int
value decimal
textvalue varchar
You can retrieve logentries for specific vehicles, timeframes and attributes - and you can extend more log attributes
withoutchanging the database structure. I would suggest another table for the attributes where you can lookup if it is
atext or numeric entry.
Just my two cents - and performance always matters (later in progress) ;-)
В списке pgsql-general по дате отправления: