How to decrease the num of segment

I need to use reindex to change query granularity and get better roll-up performance.
I want to know how to decrease the num of segments produced by reindex tasks.
Changing the num row in memory and max row in segment can’t meet my expectation. I wonder the num of segments is relative to the num of worker thread or not.

Compaction is a strategy to control segment counts…

Hi @Ze_yu_Huang,

A lot depends on the type of ingestion you are doing.
With streaming ingestion the objective is usually to consume the data quickly. More tasks in this case help that purpose when message throughput is high, but each task will output its own segments and this prevents perfect rollup. Like @vsevall mentioned, following up streaming ingestions with compaction is a best practice to consolidate segments.

In batch ingestion, using a secondary partitioning strategy of hashed or single_dim ( range if you are on 0.23 or later) produce perfect rollup as they will reorganize the data based on time and the partitioning dimensions and you should be able to tune the job to produce the approximate size of segments you are looking for.

In addition to what @vsevall and @Sergio_Ferragut have already said, If you are using reindexing, you will have to make sure that split hint spec is set to a higher limit so that each task can read from multiple segments and create fewer resultant segments. Druid sources are splittable.