From article: “You should configure the timescaledb.max_background_workers setting to be equal to the sum of your total number of databases + the total number of concurrent background workers you want running at any given point in time.”
Questions:
What is “total number of databases”? Is it databases on the same Linux server that have TimescaleDB extension installed?
How to determine the " total number of concurrent background workers you want running at any given point in time"? How to measure this?
Let’s imagine a single DB with timescaledb running and you have 1 hypertable with chunk time interval of one day.
one job running compression - (runs daily every hour)
one job refreshing continuous aggregates (runs every minute and hierarchical to hourly and daily)
You can think about retention jobs like:
one job running retention ( runs every week ). I’d even skip it.
Then, you can get the average time of every run and check how many you can fit.
The most important part is think that less is better because you may have only workers expecting for resources or more efficient usage of the actual resources. More workers means more connections open.
Last version of timescaledb also contains a new view timescaledb.jobs_stats. Just discovering it now, it can also offer some insights:
@jonatasdp, thanks for explanation. We have specific situation. We can’t use aggregation materialized views, because we are force to do heavy updates because of dirty data collected from sensors, so we don’t use jobs (except to compress one large hyper-table). We manually execute materialized tables if we need them.
Strictly following the formula timescaledb.max_background_workers = “number of database where timescaledb is installed” + “max parallel timescaledb background jobs” = 1 + 1 = 2. Default value is 16.
Is it really wise to set the number so low to 2, because according to the article is basis for setting other PostgreSQL parameters too? Or let me ask differently, what is recommended minimal setting for timescaledb.max_background_workers?