Write positions to separate database tables for each device

Andrii Honda 2 years ago

Hi. I want to write positions to separated tables in PostgreSQL database by next structure: for each device, create a table with name like device_positions_{deviceid} and with structure similar to tc_positions. I think it is a better way for storing large amount of data in database.
Can I configure Traccar to store positions by this way using configuration file?

Juan Pablo Garcia 2 years ago

Hi, i think you can use the table partition feature of postgres.
For date series data it is a good idea to partition table by range not by device, but it is up to you.
I think this is not related to traccar software, it is a feature you need to configure in the database

Anton Tananaev 2 years ago

Partitioning is what you should do instead of reinventing the wheel.

Elnaz a year ago

I know how to partition tables in database, now I'd like to know if Traccar offers any configurations for table partitioning.

Anton Tananaev a year ago

What do you mean? What kind of configuration are you looking for?

Elnaz a year ago

A configuration for creating tables by partition, i mean when traccar restarts tables(like positions) create by partition.

Anton Tananaev a year ago

No, there's no such option. Partitioning is very database specific, so there's no generic solution that Traccar can implement.